1.0.2 • Published 10 years ago
jasmine-react-matchers v1.0.2
Jasmine React Matchers
Custom Jasmine matchers to assert and compare React Elements.
Install
npm install jasmine-react-matchers --saveDescription
It makes sure that each the elements have the same:
typepropschildren
It ignores the key and any other property associated with the Element.
Usage
import ReactMatchers from 'jasmine-react-matchers';
describe('MyTest', ()=> {
beforeEach(()=> {
// Add here
jasmine.addMatchers(ReactMatchers));
}
it('does something', ()=> {
const actual = <div className="C">T</div>;
const expected = <div className="C">T</div>;
// Use here
expect(actual).toEqualElement(expected);
});
});Refer to test/ for more examples.
Development
Run tests:
npm test