"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _immutable = require("immutable");

var _chai = require("chai");

var _alerts = _interopRequireDefault(require("../alerts"));

var _constants = require("@instructure/quiz-common/lib/constants");

describe('alerts reducer', function () {
  it('adds an alert by its uuid', function () {
    var initialState = (0, _immutable.fromJS)({});
    var alertID = '123454321';
    var alertPayload = {
      uuid: alertID,
      otherAttr: 'bar'
    };
    var action = {
      type: _constants.ADD_ALERT,
      payload: alertPayload
    };
    var nextState = (0, _alerts.default)(initialState, action);
    (0, _chai.expect)(nextState.get(alertID).equals((0, _immutable.fromJS)(alertPayload))).to.be.true();
  });
  it('removes an alert by uuid', function () {
    var initialState = (0, _immutable.fromJS)({
      aaa: 1,
      bbb: 2
    });
    var action = {
      type: _constants.REMOVE_ALERT,
      payload: {
        uuid: 'bbb'
      }
    };
    var nextState = (0, _alerts.default)(initialState, action);
    (0, _chai.expect)(nextState.equals((0, _immutable.fromJS)({
      aaa: 1
    }))).to.be.true();
  });
});