import sinon from 'sinon'; // ... 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: () => ({ game: { /* game is ongoing */ } }) }; const test$ = applyForce(action$, store); testScheduler.expectObservable(test$).toBe('---a', { a: actions.applyForce({ lane: 3 }) }); testScheduler.flush(); });