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

redux-mock-store

Package Overview
Dependencies
Maintainers
1
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.1.4 to 1.2.0

.babelrc

16

lib/index.js
'use strict';
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = configureStore;
exports.default = configureStore;
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
var _redux = require('redux');
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var isFunction = function isFunction(arg) {

@@ -30,7 +30,5 @@ return typeof arg === 'function';

},
getActions: function getActions() {
return actions;
},
dispatch: function dispatch(action) {

@@ -53,7 +51,5 @@ if (typeof action === 'undefined') {

},
clearActions: function clearActions() {
actions = [];
},
subscribe: function subscribe(cb) {

@@ -82,4 +78,2 @@ if (isFunction(cb)) {

};
}
module.exports = exports['default'];
}
{
"name": "redux-mock-store",
"version": "1.1.4",
"version": "1.2.0",
"description": "",
"main": "lib/index.js",
"typings": "./index.d.ts",
"scripts": {

@@ -11,3 +10,3 @@ "prepublish": "rimraf lib && babel src --out-dir lib",

"pretest": "npm run lint",
"test": "mocha --compilers js:babel/register --reporter spec test/*.js"
"test": "mocha --compilers js:babel-core/register --reporter spec test/*.js"
},

@@ -25,3 +24,5 @@ "repository": {

"devDependencies": {
"babel": "^5.8.29",
"babel-cli": "^6.11.4",
"babel-core": "^6.13.2",
"babel-preset-es2015": "^6.13.2",
"expect": "^1.12.2",

@@ -28,0 +29,0 @@ "mocha": "^2.3.3",

@@ -27,19 +27,19 @@ [![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)

import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import configureStore from 'redux-mock-store'
import thunk from 'redux-thunk'
const middlewares = [thunk]; // add your middlewares like `redux-thunk`
const mockStore = configureStore(middlewares);
const middlewares = [thunk] // add your middlewares like `redux-thunk`
const mockStore = configureStore(middlewares)
// Test example with mocha and expect
it('should dispatch action', () => {
const initialState = {};
const addTodo = { type: 'ADD_TODO' };
const initialState = {}
const addTodo = { type: 'ADD_TODO' }
const store = mockStore(initialState);
store.dispatch(addTodo);
const store = mockStore(initialState)
store.dispatch(addTodo)
const actions = store.getActions();
const actions = store.getActions()
expect(actions).toEqual([addTodo]);
expect(actions).toEqual([addTodo])
});

@@ -52,13 +52,13 @@

type: 'FETCH_DATA_SUCCESS'
};
}
}
function fetchData() {
function fetchData () {
return dispatch => {
return fetch('/users.json') // Some async action with promise
.then(() => dispatch(success()));
.then(() => dispatch(success()))
};
}
const store = mockStore({});
const store = mockStore({})

@@ -69,3 +69,3 @@ // Return the promise

expect(store.getActions()[0]).toEqual(success())
});
})
})

@@ -72,0 +72,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