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