Skip to content

Repository files navigation

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();
});

About

Test utils for React projects

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages