【发布时间】:2021-09-01 14:20:42
【问题描述】:
如何将 callThrough 与 jasmine.createSpyObj 和带有方法返回的对象一起使用?
下面的例子不起作用。
const exampleSpy = jasmine.createSpyObj('ExampleSpy', {
method1: () => Promise.resolve(true),
method2: () => 'testResult'
});
exampleSpy.and.callThrough();
const res = exampleSpy.method2();
expect(res).toBe('testResult');
【问题讨论】:
-
不应该是
exampleSpy.method2.and.callThrough()吗? -
你好安德烈,谢谢..我找到了问题,我会回答我的问题
标签: angular typescript testing jasmine karma-jasmine