Skip to content

Commit

Permalink
jest -> vi
Browse files Browse the repository at this point in the history
  • Loading branch information
birkskyum committed Nov 21, 2024
1 parent 3da9029 commit d0d4b75
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/ui/camera.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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});
Expand All @@ -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});
Expand All @@ -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});
Expand All @@ -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});
Expand Down Expand Up @@ -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');
Expand Down
10 changes: 5 additions & 5 deletions src/ui/map_tests/map_events.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion src/util/evented.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit d0d4b75

Please sign in to comment.