export class Foo { public static bar() { doSomething(); } constructor(paramA, paramB) { } }
对于类中的方法,我们可以 jest.spyOn(Foo, 'bar')用来监视该方法。构造函数呢?我们如何监视对象的实例化?
jest.spyOn(Foo, 'bar')
javascript unit-testing jestjs
javascript ×1
jestjs ×1
unit-testing ×1