当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript TestScheduler.schedule方法代码示例

本文整理汇总了TypeScript中rxjs/testing.TestScheduler.schedule方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TestScheduler.schedule方法的具体用法?TypeScript TestScheduler.schedule怎么用?TypeScript TestScheduler.schedule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rxjs/testing.TestScheduler的用法示例。


在下文中一共展示了TestScheduler.schedule方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

  it('should return compare hot and cold observables', () => {
    const s1 = hot('---a--^---b---c---d---e---f---g---h---i---j---|');
    const s2 = cold(     '----b---c-|');
    const expected1 =    '------------(F|)';
    const subs1 =        '^           !';
    const delay =        '-------------------|';
    const s3 = cold(                        '-f---g---h---i---j---|');
    const expected2 =    '                   ---------------------(T|)';
    const subs2 =        '                   ^                    !';

    const test1 = s1.pipe(sequenceEqual(s2));
    const test2 = s1.pipe(sequenceEqual(s3));

    expectObservable(test1).toBe(expected1, booleans);
    rxTestScheduler.schedule(() => expectObservable(test2).toBe(expected2, booleans), time(delay));
    expectSubscriptions(s2.subscriptions).toBe(subs1);
    expectSubscriptions(s3.subscriptions).toBe(subs2);
  });
开发者ID:MykhailoIskiv,项目名称:rxjs,代码行数:18,代码来源:sequenceEqual-spec.ts

示例2: it

    it('should be retryable using a ReplaySubject', () => {
      function subjectFactory() { return new ReplaySubject(1); }
      const source =     cold('-1-2-3----4-#                        ');
      const sourceSubs =     ['^           !                        ',
                              '            ^           !            ',
                              '                        ^           !'];
      const multicasted = source.pipe(
        multicast(subjectFactory),
        refCount()
      );
      const expected1 =       '-1-2-3----4--1-2-3----4--1-2-3----4-#';
      const subscribe2 = time('----|                                ');
      const expected2 =       '    23----4--1-2-3----4--1-2-3----4-#';

      expectObservable(multicasted.pipe(retry(2))).toBe(expected1);

      rxTestScheduler.schedule(() =>
        expectObservable(multicasted.pipe(retry(2))).toBe(expected2), subscribe2);

      expectSubscriptions(source.subscriptions).toBe(sourceSubs);
    });
开发者ID:DallanQ,项目名称:rxjs,代码行数:21,代码来源:multicast-spec.ts

示例3: it

  it('should dispose window Subjects if the outer is unsubscribed early', () => {
    const source = hot('--a--b--c--d--e--f--g--h--|');
    const open =  cold('o-------------------------|');
    const sourceSubs = '^        !                 ';
    const expected =   'x---------                 ';
    const x = cold(    '--a--b--c-                 ');
    const unsub =      '         !                 ';
    const late =  time('---------------|           ');
    const values = { x };

    let window: Observable<string>;
    const result = source.pipe(
      windowToggle(open, () => NEVER),
      tap(w => { window = w; }),
    );

    expectObservable(result, unsub).toBe(expected, values);
    expectSubscriptions(source.subscriptions).toBe(sourceSubs);
    rxTestScheduler.schedule(() => {
      expect(() => {
        window.subscribe();
      }).to.throw(ObjectUnsubscribedError);
    }, late);
  });
开发者ID:DallanQ,项目名称:rxjs,代码行数:24,代码来源:windowToggle-spec.ts


注:本文中的rxjs/testing.TestScheduler.schedule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。