Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxianhuii committed Jan 27, 2024
1 parent 07d73e5 commit e0ad871
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/mapboxgl/web-map/control/identify/__tests__/Identify.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Identify from '../index';
import SmWebMap from '../../../WebMap.vue';
import mapLoaded from 'vue-iclient/test/unit/mapLoaded.js';
import { LineStyle, CircleStyle, FillStyle } from '../../../../_types/index';
import mapboxgl from '@libs/mapboxgl/mapbox-gl-enhance.js';

describe('Identify.vue', () => {
let wrapper;
Expand Down Expand Up @@ -85,6 +86,18 @@ describe('Identify.vue', () => {
};
}
});
const spyPopup = jest.spyOn(mapboxgl, 'Popup');
spyPopup.mockReturnValue({
setLngLat: jest.fn().mockReturnValue({
setDOMContent: jest.fn().mockReturnValue({
addTo: jest.fn().mockReturnValue({
remove: jest.fn(),
off: jest.fn(),
on: jest.fn()
})
})
})
});
const callback = jest.fn();
identifyWrapper = wrapper.vm.$children[0].$children[0];
identifyWrapper.$on('loaded', callback);
Expand Down

0 comments on commit e0ad871

Please sign in to comment.