@quoin/react-test-utils

1.0.0 • Public • Published

Quoin react test utils

Build Status Coverage Status

Utility library for testing react projects.

It makes sure that Chai uses some plugins:

API

expect()

See Chai expect.

mount()

See Enzyme's moun().

render()

See Enzyme's render().

request()

sandbox()

See Sinon's sandox().

shallow()

See Enzyme's shallow().

spy()

See Sinon's spy().

stub()

See Sinon's stub().

unexpectedFlow()

verifyProperties(clone, propertyType, properties)

This function verifies that all the properties are defined on the clone. It also deletes the property from the clone, making it useful in the following context.

The propertyType are values that would be used in Chai .to.be.a().

it(`defines known properties`, () => {
  const clone = { ...someObject };

  verifyProperties(clone, 'string', [
    'aStringProperty',
    'anotherStringProperty'
  ]);

  verifyProperties(clone, 'function', [
    'afunction',
    'anotherFunction'
  ]);

  verifyProperties(clone, 'object', [
    'anObject',
    'anotherObject'
  ]);

  expect(clone).to.be.empty();
});

Readme

Keywords

Package Sidebar

Install

npm i @quoin/react-test-utils

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

8.58 kB

Total Files

7

Last publish

Collaborators

  • bteeman
  • jtoliver
  • elimtaft-quoin