问题描述
ngOnInit() {
this.integrationsFacadeService.getTemplates();
this.actions$
.pipe(ofActionSuccessful(GetTemplates))
.subscribe(() => this.integrationsFacadeService.getTemplateOptions());
this.fields = this.getFields();
}
然后在我的测试模块中
describe('AdminCenterIntegrationAddComponent',() => {
let component: AdminCenterIntegrationAddComponent;
beforeEach(() => {
Testbed.configureTestingModule({
providers: [AdminCenterIntegrationAddComponent,{ provide: Actions,useValue: createSpyFromClass(Actions) }],}).compileComponents();
component = Testbed.inject<any>(AdminCenterIntegrationAddComponent);
});
it('should be truthy',() => {
expect(component).toBeTruthy();
});
it('ngOnInt should be ok',() => {
component.ngOnInit();
});
});
但是“ngOnInt 应该没问题”在这一行失败
this.actions$
.pipe(ofActionSuccessful(GetTemplates))
.subscribe(() => this.integrationsFacadeService.getTemplateOptions());
错误:
我试图模拟ActionSuccessful,例如:
ofActionSuccessful: () => {
return () => {
return of([]);
};
}
但我仍然遇到同样的错误。
感谢任何见解。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)