我在打字稿中单元测试代码,使用开玩笑。请教我如何模拟getData以返回预期值。我的代码如下:
// File util.ts
export const getData = async () => {
// Todo something
return data;
}
// File execution.ts import { getData } from './util';
function execute()
{
// todo something
const data = await getData();
// todo something
}
Run Code Online (Sandbox Code Playgroud)