mirror of
https://github.com/apache/superset.git
synced 2026-04-12 20:57:55 +00:00
get rid of global notify (#5355)
* [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
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
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',
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user