小编aze*_*eez的帖子

使用Jest,我如何检查模拟函数的参数是否为函数?

我正在尝试这个:

expect(AP.require).toBeCalledWith('messages', () => {})
Run Code Online (Sandbox Code Playgroud)

其中AP.require是一个模拟函数,它应该接收一个字符串,一个函数作为第二个参数.

测试失败并显示以下消息:

Expected mock function to have been called with:
  [Function anonymous] as argument 2, but it was called with [Function anonymous]
Run Code Online (Sandbox Code Playgroud)

node.js jestjs

21
推荐指数
2
解决办法
1万
查看次数

标签 统计

jestjs ×1

node.js ×1