Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ...
it('does not restart game when ongoing and emits end event when user loses', () => {
const testScheduler = new TestScheduler((actual, expected) => {
expect(actual).to.deep.equal(expected);
});
const interval$ = testScheduler.createColdObservable('--a--b', {
a: 0,
a: 1
});
sinon.stub(Observable, 'interval').returns(interval$);
const action$ = new ActionsObservable(
// Our overly eager user has started the game twice!
testScheduler.createHotObservable('aa', {
a: actions.start.click()
})
);
const store = {
getState: () => ({})
};
const getState = sinon.stub(store, 'getState');
const now = moment();
[
// ...
].forEach((gameState, i) => getState.onCall(i).returns({ game: gameState }));
const test$ = game(action$, store);
testScheduler.expectObservable(test$).toBe('a-b--(bc)', {
a: actions.start(),
b: actions.incrementTime(),
c: actions.end()
});
testScheduler.flush();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.