Skip to content

Latest commit

 

History

History
86 lines (47 loc) · 1.85 KB

File metadata and controls

86 lines (47 loc) · 1.85 KB

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