我的一个单元测试失败,输出如下所示
expect(jest.fn()).toHaveBeenCalledWith(...expected)
- Expected
+ Received
- {"cartId": "_id_", "devices": [{"foo": "bar"}], "language": "_language_", "province": "_province_"},
+ {"cartId": "_id_", "devices": [{"foo": "bar"}], "language": "_language_", "province": "_province_"},
行
expect(mockTransformer).toHaveBeenCalledWith({...
问题是,如果期望和接收的结果相同,该测试如何失败?
这是图中的测试代码:
expect(mytestingfunction).toHaveBeenCalledWith({
devices: [{ foo: 'bar' }],
cartId: '_id_',
language: '_language_',
province: '_province_'
})