【发布时间】:2019-06-26 12:05:52
【问题描述】:
在我的 Jest 测试中,我需要像这样生成一个 Bing 地图图钉:
it('...', () => {
var e = new window.Microsoft.Maps.Pushpin({ "latitude": 56.000, "longitude": 46.000 }, {});
/* do stuff */
expect(e.getColor()).toEqual('#ffd633');
})
但是当我运行测试时,我得到了错误:
TypeError: Cannot read property 'Maps' of undefined
有人知道如何在 React 中模拟 Bing Maps API Microsoft 与 Jest 的接口吗?
【问题讨论】:
标签: reactjs testing mocking jestjs bing-maps