redux-mock-store
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -61,3 +61,9 @@ 'use strict'; | ||
} | ||
return null; | ||
return function () { | ||
var index = listeners.indexOf(cb); | ||
if (index < 0) { | ||
return; | ||
} | ||
listeners.splice(index, 1); | ||
}; | ||
} | ||
@@ -64,0 +70,0 @@ }; |
{ | ||
"name": "redux-mock-store", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -33,6 +33,6 @@ [![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) | ||
it('should dispatch action', () => { | ||
const getState = {}; // initial state of the store | ||
const initialState = {}; | ||
const addTodo = { type: 'ADD_TODO' }; | ||
const store = mockStore(getState); | ||
const store = mockStore(initialState); | ||
store.dispatch(addTodo); | ||
@@ -39,0 +39,0 @@ |
@@ -130,3 +130,3 @@ import expect from 'expect'; | ||
const action = { type: 'ADD_ITEM' }; | ||
store.subscribe(() => { | ||
@@ -138,2 +138,20 @@ expect(store.getActions()[0]).toEqual(action); | ||
}); | ||
it('can unsubscribe subscribers', function (done) { | ||
const store = mockStore(); | ||
const action = { type: 'ADD_ITEM' }; | ||
const waitForMS = 25; | ||
const testWaitsAnotherMS = 25; | ||
this.timeout(waitForMS + testWaitsAnotherMS); | ||
const timeoutId = setTimeout(done, waitForMS); | ||
const unsubscribe = store.subscribe(() => { | ||
clearTimeout(timeoutId); | ||
done(new Error('should never be called')); | ||
}); | ||
unsubscribe(); | ||
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
10760
201