问题描述
我正在尝试编写一个单元测试,我像这样监视 request package:
import * as req from 'request'
spyOn(req,"get").withArgs("url",jasmine.any(Object)).and.returnValue(Promise.resolve({
"completed": true
}));
我在“url”下收到一个错误说 Argument of type 'string' is not assignable to parameter of type 'Expected<requiredUriUrl & CoreOptions>'.ts(2345)
,然后在 Promise.resolve(...) 下收到另一个错误说 Argument of type 'Promise<{ completed: boolean; }>' is not assignable to parameter of type 'Request'. Type 'Promise<{ completed: boolean; }>' is missing the following properties from type 'Request': readable,writable,debug,pipeDest,and 48 more.
谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)