我正在尝试在Ext4js中测试下面的功能
functionA: function {
functionB();
}
这是我在测试中尝试的内容:
beforeEach(function (){
somePanel= mockControlItem(subject, 'parentPanel', ['functionB']);
}
it("will run function B when functionA runs", function() {
spyOn(subject,'onIdChanged');
expect(subject).toHaveListener('show', 'functionA');
somePanel.functionB.and.returnValue(true);
subject.functionA();
expect(somePanel.functionB).toHaveBeenCalled();
}
我收到错误:toHaveBeenCalled> : Expected a spy, but got undefined.
答案 0 :(得分:0)