首先让我先说一下我是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();
});
});
我在做什么错了?