adds banner mock test

This commit is contained in:
tomlum 2021-12-02 16:23:17 -05:00 committed by seotts
parent 95f493dae8
commit b36db10da7

View file

@ -1,6 +1,7 @@
const React = require('react'); const React = require('react');
const {mountWithIntl} = require('../../helpers/intl-helpers.jsx'); const {mountWithIntl} = require('../../helpers/intl-helpers.jsx');
const EmailConfirmationBanner = require('../../../src/components/dropdown-banner/email-confirmation/banner.jsx'); const EmailConfirmationBanner = require('../../../src/components/dropdown-banner/email-confirmation/banner.jsx');
jest.mock('../../../src/components/modal/email-confirmation/modal.jsx', () => () => 'MockEmailConfirmationModal');
describe('EmailConfirmationBanner', () => { describe('EmailConfirmationBanner', () => {
@ -9,9 +10,9 @@ describe('EmailConfirmationBanner', () => {
<EmailConfirmationBanner /> <EmailConfirmationBanner />
); );
expect(component.text()).not.toContain('MockEmailConfirmationModal');
component.find('a.showEmailConfirmationModalLink').simulate('click'); component.find('a.showEmailConfirmationModalLink').simulate('click');
expect(component.text()).toContain('MockEmailConfirmationModal');
expect(component.find('div.modal-content').exists()).toBe(true);
}); });
test('Clicking X calls onRequestDismiss', () => { test('Clicking X calls onRequestDismiss', () => {