【发布时间】:2019-02-03 20:17:39
【问题描述】:
我的代码如下 ->
let mockFunction = jest.fn().mockImplementation((a) => {
this.temp = a;
});
当我如下实例化这个函数时
let mockFn = new mockFunction(6);
console.log(mockFn.temp) //this gives me undefined instead of 6
如何在 mockImplementation 函数中访问实例?
【问题讨论】:
标签: javascript unit-testing testing jestjs