Skip to content

Commit

Permalink
make snapshot tests explicit in each component
Browse files Browse the repository at this point in the history
closes #196
  • Loading branch information
apaleslimghost committed Apr 25, 2019
1 parent 4a1e973 commit f5c68fd
Show file tree
Hide file tree
Showing 14 changed files with 9,424 additions and 154 deletions.
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 nodejs 1`] = `
<div>
<span>
1
</span>
<button
disabled={false}
onClick={[Function]}
>
Increment
</button>
</div>
`;

exports[`x-increment snapshots renders a default Increment nodejs 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 nodejs 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);
});
Loading

0 comments on commit f5c68fd

Please sign in to comment.