Updating PageTemplate tests to use enzyme

This commit is contained in:
Jeff Avallone 2018-02-11 11:52:35 -05:00
parent 637c9c2afd
commit 5f11a11ba2
2 changed files with 7 additions and 9 deletions

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import renderer from 'react-test-renderer'; import { shallow } from 'enzyme';
import PageTemplate from './PageTemplate'; import PageTemplate from './PageTemplate';
@ -18,21 +18,19 @@ beforeEach(() => {
}); });
test('PageTemplate rendering', () => { test('PageTemplate rendering', () => {
const component = renderer.create( const component = shallow(
<PageTemplate> <PageTemplate>
<p>Content</p> <p>Content</p>
</PageTemplate> </PageTemplate>
); );
let tree = component.toJSON(); expect(component).toMatchSnapshot();
expect(tree).toMatchSnapshot();
}); });
test('PageTemplate rendering with title', () => { test('PageTemplate rendering with title', () => {
const component = renderer.create( const component = shallow(
<PageTemplate title="Example"> <PageTemplate title="Example">
<p>Content</p> <p>Content</p>
</PageTemplate> </PageTemplate>
); );
let tree = component.toJSON(); expect(component).toMatchSnapshot();
expect(tree).toMatchSnapshot();
}); });

View File

@ -41,7 +41,7 @@ exports[`PageTemplate rendering 1`] = `
<a <a
href="https://github.com/javallone/regexper-static" href="https://github.com/javallone/regexper-static"
> >
mock SVG <Component />
Source on GitHub Source on GitHub
</a> </a>
</li> </li>
@ -122,7 +122,7 @@ exports[`PageTemplate rendering with title 1`] = `
<a <a
href="https://github.com/javallone/regexper-static" href="https://github.com/javallone/regexper-static"
> >
mock SVG <Component />
Source on GitHub Source on GitHub
</a> </a>
</li> </li>