Skip to content

Instantly share code, notes, and snippets.

View erichulburd's full-sized avatar

Eric Hulburd erichulburd

  • Rigetti Computing
  • Berkeley, CA
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// ...
it('does not restart game when ongoing and emits end event when user loses', () => {
const testScheduler = new TestScheduler((actual, expected) => {
expect(actual).to.deep.equal(expected);
});
const interval$ = testScheduler.createColdObservable('--a--b', {
a: 0,
a: 1
context('user will lose', () => {
afterEach(() => {
Observable.interval.restore();
});
it('does not restart game when ongoing and emits end event when user loses', () => {
const testScheduler = new TestScheduler((actual, expected) => {
expect(actual).to.deep.equal(expected);
});
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);
});
context('game is paused', () => {
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
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)
})
);
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', {
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)
})
);
import { applyForce } from '../';
describe('applyForce epic', () => {
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(
import { combineEpics } from 'redux-observable';
//...
const applyForce = //...
const game = //...
export default combineEpics(
game,
applyForce
);