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/99b5ff925a0806692b5af508ea770e47 to your computer and use it in GitHub Desktop.
Save erichulburd/99b5ff925a0806692b5af508ea770e47 to your computer and use it in GitHub Desktop.
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