【发布时间】:2022-02-16 21:12:18
【问题描述】:
我想模拟我与@googlemaps/js-api-loader 包一起使用的谷歌地图API。
现在,我需要确保调用了地理编码器,并且我正在尝试这样做:
const mockGeocoder = jest.fn();
jest.mock('google.maps.Geocoder', () => () => ({
geocoder: mockGeocoder,
}));
但我明白了
Cannot find module 'google.maps.Geocoder' from 'tests/unit/usecases/maps/getPlaceByAddress.spec.ts'
3 | const mockGeocoder = jest.fn();
4 |
> 5 | jest.mock('google.maps.Geocoder', () => () => ({
不确定如何继续。谁能帮我解决这个问题?
【问题讨论】:
标签: javascript google-maps jestjs