Created
December 23, 2017 00:39
-
-
Save erichulburd/99b5ff925a0806692b5af508ea770e47 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('throttles, but does not emit applyForce if game is not ongoing', () => { | |
const testScheduler = new TestScheduler((actual, expected) => { | |
expect(actual).to.deep.equal(expected); | |
}); | |
const action$ = new ActionsObservable( | |
testScheduler.createHotObservable('aaab', { | |
a: actions.applyForce.click(2), | |
b: actions.applyForce.click(3) | |
}) | |
); | |
const throttle$ = testScheduler.createColdObservable('---a', { | |
a: actions.applyForce.click(3) | |
}); | |
sinon.stub(Observable.prototype, 'throttleTime').returns(throttle$); | |
const store = { | |
getState: () => ({ | |
game: { /* game is not ongoing */ } | |
}) | |
}; | |
const test$ = applyForce(action$, store); | |
testScheduler.expectObservable(test$).toBe('', {}); | |
testScheduler.flush(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment