Created
December 23, 2017 00:42
-
-
Save erichulburd/c34e0734689b7699ff7c89bdb4032a9c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
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