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.
This commit is contained in:
Maurice
2026-12-03 11:17:25 +01:00
parent 4b7c96f4c5
commit ea1a2527ab
2 changed files with 5 additions and 4 deletions
@@ -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(<MapView places={island} dayPlaces={island} fitKey={1} center={[-4.62, 55.44]} zoom={8} tileUrl={RASTER}
selectedPlaceId={next.id} hasInspector inspectorHeight={360} />)
+1 -1
View File
@@ -2279,7 +2279,7 @@ describe('MapViewGL', () => {
rerender(<MapViewGL places={[broken]} dayPlaces={[dayPlace]} fitKey={1} selectedPlaceId={101} />)
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(<MapViewGL places={[broken]} dayPlaces={[dayPlace]} fitKey={1} selectedPlaceId={102} />)