Skip to content

Latest commit

 

History

History

jester-react

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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