Updating Message tests to use enzyme
This commit is contained in:
parent
cabc2adc1f
commit
637c9c2afd
@ -1,25 +1,23 @@
|
||||
import React from 'react';
|
||||
import renderer from 'react-test-renderer';
|
||||
import { shallow, render } from 'enzyme';
|
||||
|
||||
import Message from './Message';
|
||||
|
||||
test('Message rendering', () => {
|
||||
const component = renderer.create(
|
||||
const component = shallow(
|
||||
<Message heading="Testing">
|
||||
<p>Message content</p>
|
||||
</Message>
|
||||
);
|
||||
let tree = component.toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('Message rendering with icon', () => {
|
||||
const Icon = () => 'Sample icon SVG';
|
||||
const component = renderer.create(
|
||||
const component = render(
|
||||
<Message heading="Testing" icon={ Icon }>
|
||||
<p>Message content</p>
|
||||
</Message>
|
||||
);
|
||||
let tree = component.toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
|
@ -15,11 +15,10 @@ exports[`Message rendering 1`] = `
|
||||
|
||||
exports[`Message rendering with icon 1`] = `
|
||||
<div
|
||||
className="message"
|
||||
class="message"
|
||||
>
|
||||
<h2>
|
||||
Sample icon SVG
|
||||
Testing
|
||||
Sample icon SVGTesting
|
||||
</h2>
|
||||
<p>
|
||||
Message content
|
||||
|
Loading…
Reference in New Issue
Block a user