diff --git a/src/ui/camera.test.ts b/src/ui/camera.test.ts index c36f64956cd..ba02be39faa 100644 --- a/src/ui/camera.test.ts +++ b/src/ui/camera.test.ts @@ -1000,7 +1000,7 @@ describe('#easeTo', () => { test('does not emit zoom events if not zooming', async () => { const camera = createCamera(); - const spy = jest.fn(); + const spy = vi.fn(); camera.on('zoomstart', spy); camera.on('zoom', spy); camera.on('zoomend', spy); @@ -1193,7 +1193,7 @@ describe('#easeTo', () => { test('jumpTo on("move") during easeTo with zoom, pitch, etc', () => { const camera = createCamera(); - const spy = jest.fn(); + const spy = vi.fn(); camera.on('moveend', spy); camera.easeTo({zoom: 20, bearing: 90, pitch: 60, duration: 500}, {done: true}); @@ -1210,7 +1210,7 @@ describe('#easeTo', () => { test('jumpTo on("zoom") during easeTo', () => { const camera = createCamera(); - const spy = jest.fn(); + const spy = vi.fn(); camera.on('moveend', spy); camera.easeTo({zoom: 20, duration: 500}, {done: true}); @@ -1227,7 +1227,7 @@ describe('#easeTo', () => { test('jumpTo on("pitch") during easeTo', () => { const camera = createCamera(); - const spy = jest.fn(); + const spy = vi.fn(); camera.on('moveend', spy); camera.easeTo({pitch: 60, duration: 500}, {done: true}); @@ -1244,7 +1244,7 @@ describe('#easeTo', () => { test('jumpTo on("rotate") during easeTo', () => { const camera = createCamera(); - const spy = jest.fn(); + const spy = vi.fn(); camera.on('moveend', spy); camera.easeTo({bearing: 90, duration: 500}, {done: true}); @@ -2142,7 +2142,7 @@ describe('#stop', () => { const eventData = {data: 'ok'}; const promise = camera.once('moveend'); - const spy = jest.fn(); + const spy = vi.fn(); camera.on('moveend', spy); const stub = vi.spyOn(browser, 'now'); diff --git a/src/ui/map_tests/map_events.test.ts b/src/ui/map_tests/map_events.test.ts index ebdb9a92ccf..5253148bcc4 100644 --- a/src/ui/map_tests/map_events.test.ts +++ b/src/ui/map_tests/map_events.test.ts @@ -90,14 +90,14 @@ describe('map events', () => { const map = createMap(); const features = [{} as MapGeoJSONFeature]; - jest.spyOn(map, 'getLayer').mockReturnValue({} as StyleLayer); - jest.spyOn(map, 'queryRenderedFeatures') + vi.spyOn(map, 'getLayer').mockReturnValue({} as StyleLayer); + vi.spyOn(map, 'queryRenderedFeatures') .mockImplementationOnce((_point, options) => { expect(options).toEqual({layers: ['layer1', 'layer2']}); return features; }); - const spy = jest.fn(); + const spy = vi.fn(); const subscription = map.on('click', ['layer1', 'layer2'], spy); subscription.unsubscribe(); @@ -947,7 +947,7 @@ describe('map events', () => { test('emits load event after a style is set', async () => { const map = new Map({container: window.document.createElement('div')} as any as MapOptions); - const failSpy = jest.fn(); + const failSpy = vi.fn(); map.on('load', failSpy); await sleep(1); @@ -1043,7 +1043,7 @@ describe('map events', () => { test('does not call listeners after unsubscribe', async () => { const map = createMap(); const error = new Error('test'); - const spy = jest.fn(); + const spy = vi.fn(); const subscription = map.on('error', spy); subscription.unsubscribe(); map.fire(new ErrorEvent(error)); diff --git a/src/util/evented.test.ts b/src/util/evented.test.ts index 5e26c4da7a5..ba53792a310 100644 --- a/src/util/evented.test.ts +++ b/src/util/evented.test.ts @@ -24,7 +24,7 @@ describe('Evented', () => { test('calls listeners added with "on" and allows to unsubscribe', () => { const evented = new Evented(); - const listener = jest.fn(); + const listener = vi.fn(); const subscription = evented.on('a', listener); evented.fire(new Event('a')); subscription.unsubscribe();