Skip to content

Instantly share code, notes, and snippets.

@adrianfaciu
Created August 28, 2017 15:37
Show Gist options
  • Save adrianfaciu/7094f08d13930fb925e9fea04c1c083e to your computer and use it in GitHub Desktop.
Save adrianfaciu/7094f08d13930fb925e9fea04c1c083e to your computer and use it in GitHub Desktop.
describe('app state effects', () => {
it('can fetch data with args from state', () => {
const source = cold('a', { a: { type: actions.DATA_WITH_STATE_FETCH } });
const storeStub = getStoreStub();
const effect = new AppStateEffect(new Actions(source), storeStub);
const expected = cold('a', { a: { type: actions.DATA_WITH_STATE_FETCH_SUCCESS } });
expect(effect.fetchDataWithState$).toBeObservable(expected);
});
function getStoreStub(): any {
const initialAppState = reducer(undefined, { type: 'INIT_ACTION' });
return {
select: (selector) => Observable.of(selector(initialAppState))
};
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment