From ea1a2527abcb5213f5ae0e10ac99458004bf89e8 Mon Sep 17 00:00:00 2001 From: Maurice Date: Thu, 3 Dec 2026 11:17:25 +0100 Subject: [PATCH] test(map): match street-level focus in map regressions Give the Leaflet fixtures definite coordinates for the strict check and update the GL day-only test to expect the street-level zoom. --- client/src/components/Map/MapView.leaflet.test.tsx | 7 ++++--- client/src/components/Map/MapViewGL.test.tsx | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/client/src/components/Map/MapView.leaflet.test.tsx b/client/src/components/Map/MapView.leaflet.test.tsx index 61aade73d..be8d51dce 100644 --- a/client/src/components/Map/MapView.leaflet.test.tsx +++ b/client/src/components/Map/MapView.leaflet.test.tsx @@ -148,8 +148,9 @@ describe('MapView on a real Leaflet map', () => { it('reveals the selected stop inside an island-wide cluster (#3306)', async () => { const island = Array.from({ length: 29 }, (_, index) => ({ // The later stops form a second cluster still too large to fan open at street level. - ...buildPlace({ id: 33060 + index, name: `Mahé stop ${index}`, lat: -4.62, - lng: index < 15 ? 55.44 + index * 0.001 : 55.447 + (index - 14) * 0.00001 }), + ...buildPlace({ id: 33060 + index, name: `Mahé stop ${index}` }), + lat: -4.62, + lng: index < 15 ? 55.44 + index * 0.001 : 55.447 + (index - 14) * 0.00001, category_name: null, category_color: null, category_icon: null, })) const selected = island[7] @@ -184,7 +185,7 @@ describe('MapView on a real Leaflet map', () => { expect(map.getZoom()).toBe(16) // At street zoom a switch to an offscreen place pans, with no zoom event to reveal it. - act(() => map.setView([-4.7, 55.4], 16, { animate: false })) + await act(() => { map.setView([-4.7, 55.4], 16, { animate: false }) }) const next = island[15] view.rerender() diff --git a/client/src/components/Map/MapViewGL.test.tsx b/client/src/components/Map/MapViewGL.test.tsx index a5550a010..6846f272d 100644 --- a/client/src/components/Map/MapViewGL.test.tsx +++ b/client/src/components/Map/MapViewGL.test.tsx @@ -2279,7 +2279,7 @@ describe('MapViewGL', () => { rerender() await act(async () => {}) - expect(glMap.flyTo).toHaveBeenCalledWith(expect.objectContaining({ center: [139.69, 35.68], zoom: 14 })) + expect(glMap.flyTo).toHaveBeenCalledWith(expect.objectContaining({ center: [139.69, 35.68], zoom: 16 })) glMap.flyTo.mockClear() rerender()