Skip to content

Instantly share code, notes, and snippets.

@erichulburd
Created December 23, 2017 00:37
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/7ca3475174d2590cc545af19d35b599e to your computer and use it in GitHub Desktop.
Save erichulburd/7ca3475174d2590cc545af19d35b599e to your computer and use it in GitHub Desktop.
it('throttles and emits apply force if game 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: () => ({ /* some state */})
};
const test$ = applyForce(action$, store);
testScheduler.expectObservable(test$).toBe('', {
// actions epic emits
});
testScheduler.flush();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment