0.3.0 • Published 6 years ago

@scotia/jester-react v0.3.0

Weekly downloads
1
License
MPL-2.0
Repository
github
Last release
6 years ago

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