@scotia/jester-react
v0.3.0
Published
Jest Helpers provides some extra functionality to simplify writing your unit tests.
Downloads
8
Readme
jester-react
Jester DRYs up your Jest + React snapshot code.
install
npm install @scotia/jester-react
usage
Provides methods that create and run tests for you using enzyme test rendering.
api
#runShallowSnapshotTests(Object : Collection<Component>)
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
});
});
#runDeepSnapshotTests(Object : Collection<Component>)
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
});
});
development
Run tests
npm run test
npm run test:watch
Build
npm run build