@scotia/jester-react

0.3.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i @scotia/jester-react

Weekly Downloads

1

Version

0.3.0

License

MPL-2.0

Last publish

Collaborators

  • tshen8
  • randysingh
  • aali
  • reyre
  • mdclements