JSX for Chai
Fork of jsx-chai
It uses [algolia/react-element-to-jsx-string][react-element-to-jsx-string] in the background to turn React elements into formatted strings.
Installation
Then install jsx-chai:
npm install jsx-chai --save-dev
Assertions
JSX comparison will kick in on deep equality checks, but normal strict equality will apply when the 'deep' flag is not used.
tobejsx tonotbejsx todeep tonotdeep to tonot to tonot
Note: include.keys()
calls will look for normal object properties, and will
not use JSX comparison.
Usage
Here's an example using mochajs/mocha.
chai Component {}
It looks like this when ran:
![Screenshot when using mocha][screenshot]
A note about functions
to.deep.equal
and to.eql
will not check for function references, it only
checks that if a function
was expected somewhere, there's also a function in
the actual data.
It's your responsibility to then unit test those functions.