mirror of
https://github.com/apache/superset.git
synced 2026-04-09 03:16:07 +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
36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
import { describe, it } from 'mocha';
|
|
import { expect } from 'chai';
|
|
|
|
import {
|
|
DANGER_TOAST,
|
|
INFO_TOAST,
|
|
SUCCESS_TOAST,
|
|
} from '../../../../src/messageToasts/constants';
|
|
|
|
import getToastsFromPyFlashMessages from '../../../../src/messageToasts/utils/getToastsFromPyFlashMessages';
|
|
|
|
describe('getToastsFromPyFlashMessages', () => {
|
|
it('should return an info toast', () => {
|
|
const toast = getToastsFromPyFlashMessages([['info', 'info test']])[0];
|
|
expect(toast).to.deep.include({ toastType: INFO_TOAST, text: 'info test' });
|
|
});
|
|
|
|
it('should return a success toast', () => {
|
|
const toast = getToastsFromPyFlashMessages([
|
|
['success', 'success test'],
|
|
])[0];
|
|
expect(toast).to.deep.include({
|
|
toastType: SUCCESS_TOAST,
|
|
text: 'success test',
|
|
});
|
|
});
|
|
|
|
it('should return a danger toast', () => {
|
|
const toast = getToastsFromPyFlashMessages([['danger', 'danger test']])[0];
|
|
expect(toast).to.deep.include({
|
|
toastType: DANGER_TOAST,
|
|
text: 'danger test',
|
|
});
|
|
});
|
|
});
|