Commit 1edd8b07 authored by Robert Knight's avatar Robert Knight

Add test for `subscribe` method of store

This method is part of the Redux store API so we don't need to test it
in detail, but this is additional verification that `createStore`
returns a working Redux store.
parent 41200677
......@@ -37,6 +37,16 @@ describe('sidebar.store.create-store', () => {
assert.equal(store.getState().count, 5);
});
it('notifies subscribers when state changes', () => {
const store = counterStore();
const subscriber = sinon.spy(() => assert.equal(store.getCount(), 1));
store.subscribe(subscriber);
store.increment(1);
assert.calledWith(subscriber);
});
it('passes initial state args to `init` function', () => {
const store = counterStore([21]);
assert.equal(store.getState().count, 21);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment