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

expect-redux-actions

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expect-redux-actions

This library adds assertions for [redux actions](http://redux.js.org/docs/advanced/AsyncActions.html) testing into [expect](https://github.com/mjackson/expect) library. It use [redux-mock-store](https://github.com/arnaudbenard/redux-mock-store) to mock re

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Expect assertions for redux actions testing

This library adds assertions for redux actions testing into expect library. It use redux-mock-store to mock redux store.

Installation

Using npm:

$ npm install --save expect-redux-actions

Then, before executing first tests:

// using ES6 modules

import expectReduxActions from 'expect-redux-actions';

// using CommonJS modules
var expectReduxActions = require('expect-redux-actions');

// initialization
expectReduxActions.registerMiddlewares([/*Here you need to list your middlewares*/]);
expectReduxActions.registerAssertions();

Assertions

toDispatchActions

expect(action).toDispatchActions(expectedActions)

Asserts that when given actionCreator is dispatched it will dispatch expectedActions. action can be plain object (action) or function (action creator). expectedActions can be can be plain object (action) or function (action creator) or array of objects/functions.

expect(myActionCreator()).toDispatchActions([myStartActionCreator(), myFinishActionCreator()], callback);

withState

expect(action).withState(state).toDispatchActions(expectedActions)

Asserts that store initialised with state before action is dispatched.

expect(myActionCreator()).withState({property: 'value'}).toDispatchActions([myStartActionCreator(), myFinishActionCreator()], callback);

FAQs

Package last updated on 03 Apr 2016

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