Jester DRYs up your Jest + React snapshot code.
npm install @scotia/jester-react
Provides methods that create and run tests for you using enzyme test rendering.
Accepts a collection of components and runs them through a shallow snapshot test. The test creates a snapshot based on enzyme shallow.
import jester from '@scotia/jester-react';
const Header = ({ children }) => <header>{children}</header>;
const Paragraph = ({ children }) => <p>{children}</p>;
describe('shallow', () => {
jester.runShallowSnapshotTests({
Header,
Paragraph
});
});
Accepts a collection of components and runs them through a deep snapshot test. The test creates a snapshot based on enzyme mount.
import jester from '@scotia/jester-react';
const Header = ({ children }) => <header>{children}</header>;
const Paragraph = ({ children }) => <p>{children}</p>;
describe('deep', () => {
jester.runDeepSnapshotTests({
Header,
Paragraph
});
});
npm run test
npm run test:watch
npm run build