mirror of
https://github.com/apache/superset.git
synced 2026-06-02 06:09:21 +00:00
* [toasts] get rid of notify globals, refactor messageToasts for use by entire app * [remove notify] use arrow func in ajax call * fix lint + tests * actually fix tests from messageToast refactor * add 'test:one' npm script * debugger * [toasts] convert bootstrap flash messages to toasts in explore + sqllab * [toasts][tests] import from right file
30 lines
867 B
JavaScript
30 lines
867 B
JavaScript
import { describe, it } from 'mocha';
|
|
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' }]);
|
|
});
|
|
});
|