Skip to content

Commit

Permalink
Test App component
Browse files Browse the repository at this point in the history
  • Loading branch information
patw0929 committed Aug 12, 2017
1 parent 3ca6799 commit 8b2108f
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/__tests__/App.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';

describe('<App />', function () {
let App;

beforeEach(() => {
jest.resetAllMocks();
App = require('../App').default;

this.makeSubject = () => {
return shallow(
<App />
);
};
});

describe('render App', () => {
beforeEach(() => {
this.subject = this.makeSubject();
});

it('should be same as snapshot', () => {
expect(toJson(this.subject)).toMatchSnapshot();
});
})
});
22 changes: 22 additions & 0 deletions src/__tests__/__snapshots__/App.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<App /> render App should be same as snapshot 1`] = `
<div
className="App"
>
<div
className="App-header"
>
<img
alt="logo"
className="App-logo"
src="logo.svg"
/>
<h2>
前端找工作
</h2>
<Connect(Timer) />
</div>
<Connect(JobList) />
</div>
`;

0 comments on commit 8b2108f

Please sign in to comment.