我有一个虚拟服务:
export class PatientService extends EntityCollectionServiceBase<Patient> {
constructor(serviceElementsFactory: EntityCollectionServiceElementsFactory) {
super('Patient', serviceElementsFactory);
}
}
我有以下测试:
describe('PatientService', () => {
let service: PatientService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(PatientService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
它给了我:
NullInjectorError: No provider for EntityCollectionServiceElementsFactory
所以我更新如下:
describe('PatientService', () => {
let service: PatientService;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [EntityDataModuleWithoutEffects.forRoot(entityConfig)],
providers: [provideMockStore()],
});
service = TestBed.inject(PatientService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
但现在它给了我:
NullInjectorError: No provider for ScannedActionsSubject!
如何正确修复我的测试?