@quoin/react-test-utils
v1.0.0
Published
Quoin's react test utils
Downloads
2
Readme
Quoin react test utils
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();
});