Socket
Socket
Sign inDemoInstall

chai-jsx

Package Overview
Dependencies
131
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    chai-jsx

JSX React Element assertions for chai


Version published
Weekly downloads
172
increased by38.71%
Maintainers
1
Install size
11.2 MB
Created
Weekly downloads
 

Readme

Source

chai-jsx

JSX React Element assertions for chai. Thin wrapper around react-element-to-jsx-string.

NPM version Build Status

Compare different React elements:

expect(<Component />).jsx.to.equal(<Component />);
expect(<Component />).jsx.to.not.equal(<Component prop={value} />);
expect(<Component />).jsx.to.not.equal(<OtherComponent />);
expect(<Component />).jsx.to.not.equal(<div />);
expect(<Component><div /></Component>).jsx.to.equal(<Component><div /></Component>);
expect(<Component><div /></Component>).jsx.to.not.equal(<Component><span /></Component>);
Installation

This is a addon plugin for the Chai Assertion Library. Install via npm.

npm install chai-jsx
Plugin

Use this plugin as you would all other Chai plugins.

var chai = require('chai')
  , chaiJsx = require('chai-jsx');

chai.use(chaiJsx);

Keywords

FAQs

Last updated on 05 Nov 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc