Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make snapshot tests explicit in each component #277

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions __tests__/snapshots.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`x-increment snapshots renders a default Async 1`] = `
<div>
<span>
1
</span>
<button
disabled={false}
onClick={[Function]}
>
Increment
</button>
</div>
`;

exports[`x-increment snapshots renders a default Increment 1`] = `
<div>
<span>
1
</span>
<button
disabled={false}
onClick={[Function]}
>
Increment
</button>
</div>
`;
6 changes: 6 additions & 0 deletions components/x-increment/__tests__/x-increment.test.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const { h } = require('@financial-times/x-engine');
const { mount } = require('@financial-times/x-test-utils/enzyme');
const snapshots = require('@financial-times/x-test-utils/snapshots');
const stories = require('../stories');

const { Increment } = require('../');

Expand Down Expand Up @@ -27,4 +29,8 @@ describe('x-increment', () => {
expect(Date.now() - start).toBeCloseTo(1000, -2); // negative precision ⇒ left of decimal point
expect(subject.find('span').text()).toEqual('2');
});

describe('snapshots', () => {
snapshots(stories);
})
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`x-styling-demo renders a default Styling 1`] = `
<button
className="Button_button__vS7Mv"
>
Click me!
</button>
`;
6 changes: 6 additions & 0 deletions components/x-styling-demo/__tests__/x-styling-demo.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const snapshots = require('@financial-times/x-test-utils/snapshots');
const stories = require('../stories');

describe('x-styling-demo', () => {
snapshots(stories);
});
3 changes: 2 additions & 1 deletion components/x-styling-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@financial-times/x-rollup": "file:../../packages/x-rollup"
"@financial-times/x-rollup": "file:../../packages/x-rollup",
"@financial-times/x-test-utils": "file:../../packages/x-test-utils"
},
"dependencies": {
"@financial-times/x-engine": "file:../../packages/x-engine",
Expand Down
Loading