为什么在测试中定义的可观察的动作$是可热观察的?

时间:2019-05-19 20:16:09

标签: ngrx-effects

是否有任何理由将可观察到的动作定义为可热观察? 当我将可观察到的热点更改为寒冷时,测试仍然成功。

Official docs

it('should return a CreateProjectSuccess action, on success', () => {
      const project = createProjectDto(
        'abc',
        'description',
        [1, 2, 3],
        ['1', '2', '3']
      );
      const resultProjectReference = { reference: 'my-project-abc' };
      const action = new ProjectActions.CreateProject(project);
      const outcome = new ProjectActions.CreateProjectSuccess(
        resultProjectReference
      );

      // Why should this be a hot observable?
      actions$ = hot('-a', { a: action });

      const response = cold('-a|', { a: resultProjectReference });
      const expected = cold('--b', { b: outcome });

      projectService.createProject.and.returnValue(response);

      expect(effects.createProject$).toBeObservable(expected);
    });

0 个答案:

没有答案