如何为 animationBuilder.build 方法编写 jasmin/karma 测试用例

时间:2021-05-20 06:37:11

标签: angular typescript jasmine karma-jasmine

我是使用 Jasmine 进行角度单元测试的新手。我正在使用 splashscreenService 为我的应用程序创建启动画面。我的代码正在运行,但我也需要 100% 的代码覆盖率。我无法在规范文件中获取 animationBuilder 提供程序来创建构建方法。如何为以下代码编写测试用例。

splash-screen.service.ts

  show() {
    this.player = this.animationBuilder.build([
      style({
        opacity: '0',
        zIndex: '99999'
      }),
      animate('400ms ease', style({ opacity: '1' }))
    ]).create(this.splashScreenEl);

    setTimeout(() => {
      this.player.play();
    }, 0);
  }

0 个答案:

没有答案