Jest正确地测试了该函数并被调用,但是伊斯坦布尔仍然说该函数未被覆盖
it('should have loaded the plc images', () => {
const mockedState : ResourceState = {
plcImages: Map()
} as any
const images = Map([
['PlcImageOne', { value: 1 }],
['PlcImageTwo', { value: 2 }]
])
console.log(mockedState.plcImages.toJS())
// {}
const loadedPlcImages = mutations[ResourceMutation.loadedPlcImages]
loadedPlcImages(mockedState, images)
console.log(mockedState.plcImages.toJS())
// { PlcImageOne: { value: 1 }, PlcImageTwo: { value: 2 } }
expect(mockedState.plcImages).toEqual(images)
})
这是正在被触发的功能(所有功能都正常运行)
[ResourceMutation.loadedPlcImages] (state: ResourceState, images: Map<string, ResourceModel>) {
state.plcImages = images
},