Files
superset2/superset/assets/spec/javascripts/messageToasts/utils/getToastsFromPyFlashMessages_spec.js
Chris Williams 19ac6e1231 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
2018-07-12 11:50:25 -07:00

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',
});
});
});