How to use the redux-observable.ActionsObservable function in redux-observable

To help you get started, we’ve selected a few redux-observable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cmelion / redux-observable-test-helpers / src / epic-helper.js View on Github external
if (done) {
                actual.should.deep.equal(expectation);
                done();
            }
        });

        if (!done) {
            // Handle any necessary data manipulation * this could be extended to take an array
            if (replace) {
                replaceValues(actual, expectation);
            }
            actual.should.deep.equal(expectation);
        }
    });

    const action$ = new ActionsObservable(
        testScheduler.createHotObservable(...action)
    );
    const responseSubs = '^!';
    const response$ = testScheduler.createColdObservable(...response);
    call = sinon.stub().returns(response$);

    const test$ = epic(action$, store, call);
    testScheduler.expectObservable(test$).toBe(...expected);
    testScheduler.flush();

    if (callArgs !== undefined) {
        call.called.should.eq(true);
        call.calledOnce.should.eq(true);
        call.calledWithExactly(...callArgs).should.eq(true);
    }
github cmelion / redux-observable-test-helpers / lib / epic-helper.js View on Github external
if (done) {
                actual.should.deep.equal(expectation);
                done();
            }
        });

        if (!done) {
            // Handle any necessary data manipulation * this could be extended to take an array
            if (replace) {
                replaceValues(actual, expectation);
            }
            actual.should.deep.equal(expectation);
        }
    });

    var action$ = new _reduxObservable.ActionsObservable(testScheduler.createHotObservable.apply(testScheduler, _toConsumableArray(action)));
    var responseSubs = '^!';
    var response$ = testScheduler.createColdObservable.apply(testScheduler, _toConsumableArray(response));
    call = _sinon2.default.stub().returns(response$);

    var test$ = epic(action$, store, call);
    (_testScheduler$expect = testScheduler.expectObservable(test$)).toBe.apply(_testScheduler$expect, _toConsumableArray(expected));
    testScheduler.flush();

    if (callArgs !== undefined) {
        var _call;

        call.called.should.eq(true);
        call.calledOnce.should.eq(true);
        (_call = call).calledWithExactly.apply(_call, _toConsumableArray(callArgs)).should.eq(true);
    }
github Shyam-Chen / React-Starter / src / app / playground / counter / __tests__ / epics.spec.js View on Github external
it('should call get cancelCountEpic', () => {
      const observable = new ActionsObservable(actions);
      expect(cancelCountEpic(observable)).toBeDefined();
    });
  });
github Shyam-Chen / React-Starter / src / app / playground / counter / __tests__ / epics.spec.js View on Github external
it('should call get decrementIfEvenEpic', () => {
      const observable = new ActionsObservable(actions);
      expect(decrementIfEvenEpic(observable)).toBeDefined();
    });
github Shyam-Chen / React-Starter / src / app / playground / counter / __tests__ / epics.spec.js View on Github external
it('should call get startCountEpic', () => {
      const observable = new ActionsObservable(actions);
      expect(startCountEpic(observable)).toBeDefined();
    });
github yacut / tester / spec / redux / epics / updateEditor-spec.js View on Github external
it('dispatches the correct actions when testOnOpen enabled  and testOnSave disabled', asyncTest(async (done) => {
    atom.config.set('tester.testOnOpen', true);
    atom.config.set('tester.testOnSave', false);
    spyOn(decorateManager, 'handleGutter').andCallFake(() => Promise.resolve());
    const expectedOutputActions = [actions.testAction()];
    const action$ = new ActionsObservable(Observable.of(actions.updateEditorAction(textEditor)));
    const actualOutputActions = [];
    updateEditorEpic(action$).subscribe(action => actualOutputActions.push(action));
    textEditor.saveAs(getFixturesPath());

    expect(actualOutputActions).toEqual(expectedOutputActions);
    expect(await decorateManager.handleGutter).toHaveBeenCalled();
    done();
  }));
  it('dispatches the correct actions when testOnOpen and testOnSave enabled', asyncTest(async (done) => {
github nteract / nteract / packages / core / __tests__ / epics / kernel-lifecycle-spec.js View on Github external
selectNextKernel: true,
        contentRef: contentRef
      }),
      e: actions.restartKernelSuccessful({
        kernelRef: newKernelRef,
        contentRef: contentRef
      }),
      f: actions.executeAllCells({
        contentRef: contentRef
      })
    };

    const inputMarbles = "a   b   |";
    const outputMarbles = "(cd)(ef)|";

    const inputAction$ = new ActionsObservable(
      testScheduler.createHotObservable(inputMarbles, inputActions)
    );
    const outputAction$ = restartKernelEpic(
      inputAction$,
      store,
      () => newKernelRef
    );

    testScheduler
      .expectObservable(outputAction$)
      .toBe(outputMarbles, outputActions);
    testScheduler.flush();
  });
});
github geosolutions-it / MapStore2 / web / client / epics / __tests__ / epicTestUtils.js View on Github external
testEpic: (epic, count, action, callback, state = {}) => {
        const actions = new Rx.Subject();
        const actions$ = new ActionsObservable(actions);
        const store = { getState: () => isFunction(state) ? state() : state, dispatch: () => {}};
        epic(actions$, store)
            .take(count)
            .toArray()
            .subscribe(callback);
        if (action.length) {
            action.map(act => actions.next(act));
        } else {
            actions.next(action);
        }
    },
    /**
github yacut / tester / spec / common.js View on Github external
export function getEpicActions(epic: TesterEpic, action: TesterAction, currentState: TesterState = state) {
  const actions = new Subject();
  const actions$ = new ActionsObservable(actions);
  const store = {
    getState: () => currentState,
    dispatch: a => ActionsObservable.concat(actions$, Observable.of(a)),
  };
  const promiseEpic = epic(actions$, store)
    .toArray()
    .toPromise();

  actions.next(action);
  actions.complete();

  return promiseEpic;
}
github Brooooooklyn / redux-epics-decorator / src / decorators / DefineAction.ts View on Github external
const epic = (actions$: ActionsObservable>) => {
      const actionSubject$ = new Subject>()
      action$ = new ActionsObservable(actionSubject$)
      return actions$.pipe(
        ofType(actionWithNamespace),
        tap(actionSubject$),
        mergeMap(() => EMPTY),
      )
    }