Skip to content

Instantly share code, notes, and snippets.

@erichulburd
Created December 23, 2017 00:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erichulburd/275b52967755745d7ea764f4c03e8713 to your computer and use it in GitHub Desktop.
Save erichulburd/275b52967755745d7ea764f4c03e8713 to your computer and use it in GitHub Desktop.
context('game is paused', () => {
it(`interval starts when user starts game and is stopped when end emitted`, () => {
const testScheduler = new TestScheduler((actual, expected) => {
expect(actual).to.deep.equal(expected);
});
const interval$ = testScheduler.createColdObservable('--a--b--c', {
a: 0,
b: 1,
c: 2
});
sinon.stub(Observable, 'interval').returns(interval$);
const store = {
getState: () => ({
game: { /* game is paused */ }
})
};
const action$ = new ActionsObservable(
testScheduler.createHotObservable('', {
// incoming actions
})
);
const test$ = game(action$, store);
testScheduler.expectObservable(test$).toBe('', {
// actions epic emits
});
testScheduler.flush();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment