in src/index.ts [97:132]
public test(marbles: string = '-', expectations: IEpicExpectationMap<Action> = {}) {
const scheduler = new TestScheduler(
(
actual: Array<ISchedulerData<Action>>,
expected: Array<ISchedulerData<EpicExpectation<Action>>>,
) => {
const assertion = Assertion.create(expectations, expected, actual);
if (assertion.failed()) {
throw new AssertionError({
message: assertion.annotate(),
});
}
},
);
// lots of <any> here. TestScheduler typings are not very good, and
// we do some patching for concise tests.
scheduler.run(helpers => {
const state = this.getState(helpers).pipe(map(unfactorize));
const output = merge(
this.epic(
this.getActions(helpers).pipe(map(unfactorize)) as any,
state as any,
this.services as any,
),
state.pipe(
map(unfactorize),
tap(value => ((state as any).value = value)),
ignoreElements(),
),
);
helpers.expectObservable(output).toBe(marbles, expectations);
});
return this;
}