redux-mock-store
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -24,2 +24,3 @@ 'use strict'; | ||
var actions = []; | ||
var listeners = []; | ||
@@ -38,2 +39,6 @@ var self = { | ||
for (var i = 0; i < listeners.length; i++) { | ||
listeners[i](); | ||
} | ||
return action; | ||
@@ -46,3 +51,6 @@ }, | ||
subscribe: function subscribe() { | ||
subscribe: function subscribe(cb) { | ||
if (isFunction(cb)) { | ||
listeners.push(cb); | ||
} | ||
return null; | ||
@@ -49,0 +57,0 @@ } |
{ | ||
"name": "redux-mock-store", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "", | ||
"main": "lib/index.js", | ||
"typings": "./index.d.ts", | ||
"scripts": { | ||
@@ -7,0 +8,0 @@ "prepublish": "rimraf lib && babel src --out-dir lib", |
@@ -43,3 +43,3 @@ [![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) | ||
// Promise test example with mocha and expect | ||
it('should execute promise', (done) => { | ||
it('should execute promise', () => { | ||
function success() { | ||
@@ -60,6 +60,6 @@ return { | ||
store.dispatch(fetchData()) | ||
// Return the promise | ||
return store.dispatch(fetchData()) | ||
.then(() => { | ||
expect(store.getActions()[0]).toEqual(success()) | ||
done(); | ||
}); | ||
@@ -78,2 +78,3 @@ }) | ||
- store.clearActions() | ||
- store.subscribe() | ||
``` | ||
@@ -80,0 +81,0 @@ |
@@ -107,7 +107,12 @@ import expect from 'expect'; | ||
it('has empty subscribe method', () => { | ||
it('subscribes to dispatched actions', (done) => { | ||
const store = mockStore(); | ||
expect(store.subscribe()).toEqual(null); | ||
const action = { type: 'ADD_ITEM' }; | ||
store.subscribe(() => { | ||
expect(store.getActions()[0]).toEqual(action); | ||
done(); | ||
}); | ||
store.dispatch(action); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9078
8
164
82