mirror of
https://github.com/apache/superset.git
synced 2026-04-11 04:15:33 +00:00
* [lint] turn no-undef back on, set browser, cypress, and mocha env's, and fix issues * [lint] fix undefined var in TimeTable.jsx
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
import React from 'react';
|
|
import { shallow } from 'enzyme';
|
|
import { expect } from 'chai';
|
|
|
|
import mockMessageToasts from '../mockMessageToasts';
|
|
import Toast from '../../../../src/messageToasts/components/Toast';
|
|
import ToastPresenter from '../../../../src/messageToasts/components/ToastPresenter';
|
|
|
|
describe('ToastPresenter', () => {
|
|
const props = {
|
|
toasts: mockMessageToasts,
|
|
removeToast() {},
|
|
};
|
|
|
|
function setup(overrideProps) {
|
|
const wrapper = shallow(<ToastPresenter {...props} {...overrideProps} />);
|
|
return wrapper;
|
|
}
|
|
|
|
it('should render a div with class toast-presenter', () => {
|
|
const wrapper = setup();
|
|
expect(wrapper.find('.toast-presenter')).to.have.length(1);
|
|
});
|
|
|
|
it('should render a Toast for each toast object', () => {
|
|
const wrapper = setup();
|
|
expect(wrapper.find(Toast)).to.have.length(props.toasts.length);
|
|
});
|
|
|
|
it('should pass removeToast to the Toast component', () => {
|
|
const removeToast = () => {};
|
|
const wrapper = setup({ removeToast });
|
|
expect(
|
|
wrapper
|
|
.find(Toast)
|
|
.first()
|
|
.prop('onCloseToast'),
|
|
).to.equal(removeToast);
|
|
});
|
|
});
|