这在文档中并不明显,但是...toBeCalledWith和之间有什么区别toHaveBeenCalledWith?
sli*_*wp2 21
从文档https://jestjs.io/docs/en/expect#tohavebeenCalledwitharg1-arg2-
.toHaveBeenCalledWith(arg1, arg2, ...) 在别名下: .toBeCalledWith()
从源代码:
//...
toBeCalledWith: createToBeCalledWithMatcher('toBeCalledWith'),
toHaveBeenCalled: createToBeCalledMatcher('toHaveBeenCalled'),
toHaveBeenCalledTimes: createToBeCalledTimesMatcher('toHaveBeenCalledTimes'),
toHaveBeenCalledWith: createToBeCalledWithMatcher('toHaveBeenCalledWith'),
//...
Run Code Online (Sandbox Code Playgroud)
它们是由createToBeCalledWithMatcher具有不同名称的函数创建的。
所以,他们是一样的。
| 归档时间: |
|
| 查看次数: |
3598 次 |
| 最近记录: |