伊斯坦布尔一直显示“功能未涵盖”

时间:2018-07-12 15:42:23

标签: javascript typescript unit-testing jestjs istanbul

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
},

istanbul error/message

0 个答案:

没有答案