Angular服务类单元测试失败,无法解析所有参数

时间:2018-08-28 23:48:16

标签: angular jasmine karma-jasmine

首先让我先说一下我是Angular和茉莉花/业力单元测试的新手。我正在尝试为服务类编写一个简单的测试。测试失败:

错误:无法解析BlahBlahService的所有参数:(?)。

这是服务类别:

export abstract class BlahBlahService extends BehaviorSubject<GridDataResult>

这是服务构造函数的样子:

constructor(private http: HttpClient) {
    super(null);    
}

这是我的测试

import { TestBed, inject } from '@angular/core/testing';
import { ProductivityStatsService } from './blah-blah.service';
import { HttpClientTestingModule, HttpTestingController } from "@angular/common/http/testing";

describe('BlahBlahService', () => {
   let httpTestingController: HttpTestingController;
   let service: BlahBlahService;

   beforeEach(() => {
     TestBed.configureTestingModule({
       imports: [ HttpClientTestingModule ],
       providers: [BlahBlahService]
     });

     httpTestingController = TestBed.get(HttpTestingController);
     service = TestBed.get(BlahBlahService);
   });  

   it('should work', () => {
     expect(service).toBeTruthy();
   });

 });

我在做什么错了?

0 个答案:

没有答案