Files
superset2/superset/assets/spec/javascripts/messageToasts/reducers/messageToasts_spec.js
Chris Williams b453cd2bf2 [lint] turn no-undef back on, set browser, cypress, and mocha env's (#5879)
* [lint] turn no-undef back on, set browser, cypress, and mocha env's, and fix issues

* [lint] fix undefined var in TimeTable.jsx
2018-09-13 14:45:24 -07:00

29 lines
829 B
JavaScript

import { expect } from 'chai';
import { ADD_TOAST, REMOVE_TOAST } from '../../../../src/messageToasts/actions';
import messageToastsReducer from '../../../../src/messageToasts/reducers';
describe('messageToasts reducer', () => {
it('should return initial state', () => {
expect(messageToastsReducer(undefined, {})).to.deep.equal([]);
});
it('should add a toast', () => {
expect(
messageToastsReducer([], {
type: ADD_TOAST,
payload: { text: 'test', id: 'id', type: 'test_type' },
}),
).to.deep.equal([{ text: 'test', id: 'id', type: 'test_type' }]);
});
it('should add a toast', () => {
expect(
messageToastsReducer([{ id: 'id' }, { id: 'id2' }], {
type: REMOVE_TOAST,
payload: { id: 'id' },
}),
).to.deep.equal([{ id: 'id2' }]);
});
});