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

View File

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