Created
December 23, 2017 00:40
-
-
Save erichulburd/0a6fcc1be897bb658e3ff2d2676c2675 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
context('game is paused', () => { | |
afterEach(() => { | |
Observable.interval.restore(); | |
}); | |
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('a-----b', { | |
a: actions.start.click(), | |
b: actions.end() | |
}) | |
); | |
const test$ = game(action$, store); | |
testScheduler.expectObservable(test$).toBe('a-b--b', { | |
a: actions.start() | |
b: actions.incrementTime() | |
}); | |
testScheduler.flush(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment