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

redux-mock-store

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-mock-store - npm Package Compare versions

Comparing version 1.2.3 to 1.3.0

2

lib/index.js

@@ -28,3 +28,3 @@ 'use strict';

getState: function getState() {
return isFunction(_getState) ? _getState() : _getState;
return isFunction(_getState) ? _getState(actions) : _getState;
},

@@ -31,0 +31,0 @@ getActions: function getActions() {

{
"name": "redux-mock-store",
"version": "1.2.3",
"version": "1.3.0",
"description": "A mock store for testing your redux async action creators and middleware",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -1,9 +0,6 @@

# redux-mock-store
# redux-mock-store [![Circle CI](https://circleci.com/gh/arnaudbenard/redux-mock-store/tree/master.svg?style=svg)](https://circleci.com/gh/arnaudbenard/redux-mock-store/tree/master)
[![Circle CI](https://circleci.com/gh/arnaudbenard/redux-mock-store/tree/master.svg?style=svg)](https://circleci.com/gh/arnaudbenard/redux-mock-store/tree/master)
![npm](https://nodei.co/npm/redux-mock-store.png?downloads=true&downloadRank=true&stars=true)
[![JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
A mock store for testing your redux async action creators and middleware. The mock store will create an array of dispatched actions which serve as an action log for tests.

@@ -28,1 +25,3 @@

MIT
<a href="https://app.codesponsor.io/link/jxMtyJ1U2FXauYmvU37ewrmE/arnaudbenard/redux-mock-store" rel="nofollow"><img src="https://app.codesponsor.io/embed/jxMtyJ1U2FXauYmvU37ewrmE/arnaudbenard/redux-mock-store.svg" style="width: 888px; height: 68px;" alt="Sponsor" /></a>

@@ -12,15 +12,31 @@ /* eslint-env mocha */

describe('redux-mock-store', () => {
it('calls getState if it is a function', () => {
const getState = sinon.spy()
const store = mockStore(getState, [])
describe('getState', () => {
describe('if it is a function', () => {
it('returns the result of getState call', () => {
const getState = sinon.spy()
const store = mockStore(getState)
store.getState()
expect(getState.called).toBe(true)
})
store.getState()
expect(getState.called).toBe(true)
})
it('returns the initial state', () => {
const initialState = { items: [], count: 0 }
const store = mockStore(initialState)
it('returns the result of getState call with actions', () => {
const action = { type: 'ADD_ITEM' }
const getState = sinon.spy()
const store = mockStore(getState)
expect(store.getState()).toEqual(initialState)
store.dispatch(action)
store.getState()
expect(getState.calledWith([action])).toBe(true)
expect(getState.calledWith(store.getActions())).toBe(true)
})
})
describe('if it is not a function', () => {
it('returns the initial state', () => {
const initialState = { items: [], count: 0 }
const store = mockStore(initialState)
expect(store.getState()).toEqual(initialState)
})
})
})

@@ -27,0 +43,0 @@

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