angularfirestore服务的单元测试

时间:2017-12-08 11:30:43

标签: angular angularfire2

如何使用AngularFirestore为服务编写单元测试?

目前我有以下内容:

import { AngularFirestore } from 'angularfire2/firestore';
export class AngularFireStoreStub extends AngularFirestore {}

  beforeEach(() => {
    TestBed.configureTestingModule({
      providers: [ DataModelService,
        { provide: AngularFirestore, useClass: AngularFireStoreStub },
    ]
    });
  });

  it('should be created', inject([DataModelService], (service: DataModelService) => {
    expect(service).toBeTruthy();
  }));
});

然而,这在Jasmine中给出了以下错误:

Error: Can't resolve all parameters for AngularFireStoreStub: ([object Object], ?).

由于我对角度单位测试相对较新,这对我帮助不大。

0 个答案:

没有答案