mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 15:47:53 -05:00
email-modal-tests
This commit is contained in:
parent
938f3f4dbf
commit
e57a60eb08
1 changed files with 41 additions and 0 deletions
41
test/unit/components/email-confirmation-modal.test.jsx
Normal file
41
test/unit/components/email-confirmation-modal.test.jsx
Normal file
|
@ -0,0 +1,41 @@
|
|||
const React = require('react');
|
||||
const {mountWithIntl} = require('../../helpers/intl-helpers.jsx');
|
||||
const EmailConfirmationModal = require('../../../src/components/modal/email-confirmation/modal.jsx');
|
||||
import configureStore from 'redux-mock-store';
|
||||
|
||||
|
||||
describe('Modal', () => {
|
||||
const mockStore = configureStore();
|
||||
let defaultStore;
|
||||
const testEmail = 'test123@email.com';
|
||||
|
||||
beforeEach(() => {
|
||||
defaultStore = mockStore({
|
||||
session: {
|
||||
session: {
|
||||
user: {
|
||||
email: testEmail
|
||||
},
|
||||
permissions: {}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test('Display email prop correctly', () => {
|
||||
const component = mountWithIntl(
|
||||
<EmailConfirmationModal
|
||||
isOpen
|
||||
/>, {context: {store: defaultStore}}
|
||||
);
|
||||
expect(component.find('div.modal-right-content').text()).toContain(testEmail);
|
||||
});
|
||||
|
||||
test('Close button shows correctly', () => {
|
||||
const component = mountWithIntl(
|
||||
<EmailConfirmationModal />, {context: {store: defaultStore}}
|
||||
);
|
||||
expect(component.find('div.modal-content-close').exists()).toBe(false);
|
||||
expect(component.find('img.modal-content-close-img').exists()).toBe(false);
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue