Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}
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);
}
it('should call get cancelCountEpic', () => {
const observable = new ActionsObservable(actions);
expect(cancelCountEpic(observable)).toBeDefined();
});
});
it('should call get decrementIfEvenEpic', () => {
const observable = new ActionsObservable(actions);
expect(decrementIfEvenEpic(observable)).toBeDefined();
});
it('should call get startCountEpic', () => {
const observable = new ActionsObservable(actions);
expect(startCountEpic(observable)).toBeDefined();
});
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) => {
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();
});
});
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);
}
},
/**
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;
}
const epic = (actions$: ActionsObservable>) => {
const actionSubject$ = new Subject>()
action$ = new ActionsObservable(actionSubject$)
return actions$.pipe(
ofType(actionWithNamespace),
tap(actionSubject$),
mergeMap(() => EMPTY),
)
}