我在单元测试中遇到错误TypeError: Cannot read property 'subscribe' of undefined
,如何解决?
我的部分代码:
规格
it('makes expected calls', () => {
const item1: item3 = fixture.debugElement.injector.get(item3);
spyOn(comp, 'item5');
spyOn(item1, 'item2');
comp.item4();
expect(comp.item5).toHaveBeenCalled();
expect(item1.item2).toHaveBeenCalled();
});

如果我删除这部分规范,我就会获得成功。
我使用subscribe()正确的方法吗?
答案 0 :(得分:4)
尝试为方法cat > file <<EOF
HF.fchk
3
21
2
2
EOF
grep 'Global surface minimum:' HF-ESP.out | awk '{print $7,$8,$9,$7,$8,$9}' >> file
echo EXIT >> file
./Multiwfn < file >HF-Dr.out
rm file
创建的间谍提供模拟Observable
Jasmine间谍returnValue
,以便组件能够isPeriodCycleOpen
提供:
subscribe
希望这有帮助!
答案 1 :(得分:0)
我认为你错过了spyon方法的返回值,试试这个:
$response = $control->receive('UpdateConfig',$cmd);