šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

unexpected-react

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unexpected-react

Extends the Unexpected assertion library for an easy integration width ReactJS components

0.2.0
Source
npm
Version published
Weekly downloads
476
20.2%
Maintainers
1
Weekly downloads
Ā 
Created
Source

unexpected-react

React plugin for the Unexpected assertion library

TODO

expect.addType({
    identify: function (obj) { return obj && obj._lifeCycleState; },
    inspect: function (value, depth, output, inspect) { output.text('<React.js component...>'); }
});
expect(ReactComponent, 'to have props', { foo: 'bar' }); // Uses expect.it('to satisfy')
expect(ReactComponent, 'to have state', { foo: 'bar' }); // Uses expect.it('to satisfy')
expect(ReactComponent, 'to have html attributes', { foo: 'bar' });
expect(ReactComponent.refs['menu'], 'to have html attributes', { foo: 'bar' });
// Should call getDOMNode(), pull out attributes and compare
// Might be enough to assert on the virtual dom
expect(ReactComponent, 'to have children', [optionalSelector], 6);
// Should call getDOMNode(), compare length
expect(ReactComponent, 'to have children who satisfy', [optionalSelector], function (child) {
    expect.it(child, 'to have html attributes', { foo: 'bar' });
});
expect(ReactComponent.refs['modal'], 'to be a component', 'ModalComponent');

Keywords

unexpected

FAQs

Package last updated on 14 Apr 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