x-dash
x-dash copied to clipboard
switch jest snapshots to use storyshots
https://github.com/storybooks/storybook/tree/release/3.4/addons/storyshots
pros:
- less custom x-dash magic is good
cons:
- i do not trust storybook
I think the latter is why I avoided it when first implementing snapshots...
We could get rid of the "magic" aspect and instead encourage/force components to include their own tests (which would resolve #152). There may be some repetition but that's OK, it's one code base so refactors are possible!
how would you feel about adding something to x-test-utils to do this? then each component would have its own __tests__ folder that could do something like:
import { storySnapshotTests } from '@financial-times/x-test-utils';
describe('x-teaser', () => {
storySnapshotTests();
});
edit: maybe make it more explicit:
import stories from '../stories';
import { storySnapshotTests } from '@financial-times/x-test-utils';
describe('x-teaser', () => {
storySnapshotTests(stories);
});
Pretty OK!