fix(map): read the last fitBounds call without Array.at

The client's tsconfig targets a lib without Array.prototype.at, so the two
new assertions typechecked locally against the test runner but not against
tsc. Index arithmetic instead.
This commit is contained in:
Maurice
2026-08-20 17:44:15 +02:00
committed by Maurice
parent 7aead0b713
commit bb0d65bb19
+4 -2
View File
@@ -935,7 +935,8 @@ describe('MapView bounds fitting', () => {
rerender(<MapView places={places} dayPlaces={places} fitKey={2} hasDayDetail />)
expect(mapMock.fitBounds).toHaveBeenCalled()
const opts = mapMock.fitBounds.mock.calls.at(-1)?.[1] as { paddingBottomRight?: [number, number] }
const calls = mapMock.fitBounds.mock.calls
const opts = calls[calls.length - 1]?.[1] as { paddingBottomRight?: [number, number] }
expect(opts?.paddingBottomRight?.[1]).toBe(280)
// Long enough that the old 300ms nudge would have fired by now.
@@ -951,7 +952,8 @@ describe('MapView bounds fitting', () => {
const { rerender } = render(<MapView places={places} dayPlaces={places} fitKey={1} />)
rerender(<MapView places={places} dayPlaces={places} fitKey={2} />)
const opts = mapMock.fitBounds.mock.calls.at(-1)?.[1] as { paddingBottomRight?: [number, number] }
const calls = mapMock.fitBounds.mock.calls
const opts = calls[calls.length - 1]?.[1] as { paddingBottomRight?: [number, number] }
expect(opts?.paddingBottomRight?.[1]).toBe(60)
})