javascript - 使用 Jest 深入测试来自属性对象的匿名函数的嵌套返回值
问题描述
解决方案
你可能想要这样的东西:
const {prop1, prop2, prop3} = myFunction({
someProp1: 'a',
someProp2: 'b',
someProp3: 'c',
})
expect(prop1(value)).toEqual(
// something here
)
expect(prop2(value)).toEqual(
// something here
)
expect(prop3(value)).toEqual(
// something here
)
推荐阅读
- c++ - 断言意图:assert(!distNodePt == !indexNodePt)
- python - Django 3 - NoReverseMatch
- html - 如何为表单中的单选按钮提供自定义外观?
- javascript - 如何在 react.js 中使用 onclick 事件处理程序调用类组件
- c++ - QTime 在 linux 和 windows 平台上表现不同
- kotlin - ALTER TABLE 迁移不会更新生成的代码
- itext7 - Itext7 - 如何使用java中的图像创建每页2列4行的pdf
- grpc - 如何取消 GRPC 流式调用?
- visual-studio - 在“应用程序”类型中找不到属性“退出”
- python - 修改二维数组中的备用索引值 - Python