2019-01-04 23:38:49 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { shallow } from 'enzyme';
|
|
|
|
|
|
|
|
import Message from 'components/Message';
|
|
|
|
|
|
|
|
describe('Message', () => {
|
|
|
|
test('rendering', () => {
|
|
|
|
const component = shallow(
|
|
|
|
<Message heading="Testing">
|
|
|
|
<p>Message content</p>
|
|
|
|
</Message>
|
|
|
|
);
|
|
|
|
expect(component).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
|
|
|
test('rendering with icon', () => {
|
|
|
|
const Icon = () => 'Sample icon SVG';
|
|
|
|
const component = shallow(
|
|
|
|
<Message heading="Testing" icon={ Icon }>
|
|
|
|
<p>Message content</p>
|
|
|
|
</Message>
|
|
|
|
);
|
|
|
|
expect(component).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
|
|
|
test('rendering with type', () => {
|
|
|
|
const component = shallow(
|
|
|
|
<Message heading="Testing" type="error">
|
|
|
|
<p>Message content</p>
|
|
|
|
</Message>
|
|
|
|
);
|
|
|
|
expect(component).toMatchSnapshot();
|
|
|
|
});
|
2019-01-19 18:41:42 +00:00
|
|
|
|
|
|
|
test('rendering with a close button', () => {
|
|
|
|
const component = shallow(
|
|
|
|
<Message heading="Testing" onClose={ jest.fn() }>
|
|
|
|
<p>Message content</p>
|
|
|
|
</Message>
|
|
|
|
);
|
|
|
|
expect(component).toMatchSnapshot();
|
|
|
|
});
|
2019-01-04 23:38:49 +00:00
|
|
|
});
|