本文整理汇总了TypeScript中rxjs/testing.TestScheduler.run方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TestScheduler.run方法的具体用法?TypeScript TestScheduler.run怎么用?TypeScript TestScheduler.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rxjs/testing.TestScheduler
的用法示例。
在下文中一共展示了TestScheduler.run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should clear out meesages array after 3 sec', () => {
const testScheduler = new TestScheduler((actual, expected) => {
expect(component.messages.length).toBe(0);
});
testScheduler.run(({ cold, expectObservable }) => {
const input = cold('-a--|');
input.pipe(tap(v => component.message$.next({} as any)));
const expected = '-- 2999ms a ---|';
expectObservable(component.remover$).toBe(expected);
});
});
示例2: it
it('should return false if observables to the left of false have produced a value', () => {
testScheduler.run(({hot, cold, expectObservable}) => {
const a = cold(' --(T|)', TF);
const b = cold(' ----------(T|)', TF);
const c = cold(' ------(F|)', TF);
const source = hot('---o--', {o: [a, b, c]});
const expected = ' -------------F--';
expectObservable(source.pipe(prioritizedGuardValue()))
.toBe(expected, TF, /* an error here maybe */);
});
});