【发布时间】:2019-09-16 05:43:07
【问题描述】:
我不确定我是否写了一个关于这个问题的好标题。 如何模拟和绕过这2条红线?
fit('Should call the sub entity list', () => {
expect(component.subentity.length).toBe(0);
spyOn(subentitysvc, 'getSubEntityList').and.returnValue(of(modelMock));
component.getSubEntityList(1);
fixture.detectChanges();
expect(subentitysvc.getSubEntityList).toHaveBeenCalled();
spyOn(toastr, 'error').and.callFake(() => { });
})
【问题讨论】:
标签: angular unit-testing rxjs