Updating Message tests to use enzyme

This commit is contained in:
Jeff Avallone 2018-02-11 11:50:08 -05:00
parent cabc2adc1f
commit 637c9c2afd
2 changed files with 7 additions and 10 deletions

View File

@ -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();
});

View File

@ -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