Skip to content

Commit

Permalink
.dispatch() test
Browse files Browse the repository at this point in the history
  • Loading branch information
ersimont committed Nov 26, 2017
1 parent 23bbe69 commit 9f733db
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions lib/src/store-object.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,25 @@ describe('StoreObject', () => {
});
});

describe('.state()', () => {
it('')
});

describe('.dispatch()', () => {
it('')
it('forwards actions on to ngrx', () => {
let callCount = 0;
backingStore.addReducer('testKey', (state = {}, action) => {
if (action.type === 'the action') { ++callCount; }
return state;
});
store.dispatch({type: 'the action'});
expect(callCount).toBe(1);

store('nested').dispatch({type: 'the action'});
expect(callCount).toBe(2);

store('counter').batch((batch) => {
batch.dispatch({type: 'the action'});
expect(callCount).toBe(3);
});
expect(callCount).toBe(3);
});
});

function getGlobalState() {
Expand Down

0 comments on commit 9f733db

Please sign in to comment.