Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jasmine-react-matchers

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jasmine-react-matchers

Custom matchers to test React Elements

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-20%
Maintainers
1
Weekly downloads
 
Created
Source

Jasmine React Matchers

Custom Jasmine matchers to assert and compare React Elements.

Install

npm install jasmine-react-matchers --save

Description

It makes sure that each the elements have the same:

  • type
  • props
  • children

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

License

MIT

Keywords

FAQs

Package last updated on 28 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc