【发布时间】:2020-03-28 15:30:00
【问题描述】:
我在 Typescript 中有一个非常简单的包装类:
import { parse, UrlWithParsedQuery } from 'url';
export class Utils {
public static parseUrl(url: string): UrlWithParsedQuery {
return parse(url, true);
}
}
如何对 parse 方法的调用进行单元测试? 在我的单元测试中,这种方法不起作用:
jest.spyOn('url', parse); // error: No overload matches this call.
【问题讨论】:
标签: node.js typescript unit-testing jestjs