Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

test(map): opening another trip with the overview on frames that trip

Mauricefd5afb0fad00
diff --git a/client/src/components/Map/useTripRouteOverview.test.ts b/client/src/components/Map/useTripRouteOverview.test.ts
index e236e7a75..4561eb118 100644
--- a/client/src/components/Map/useTripRouteOverview.test.ts
+++ b/client/src/components/Map/useTripRouteOverview.test.ts
@@ -255,4 +255,22 @@ describe('useTripRouteOverview', () => {
await waitFor(() => expect(result.current.loading).toBe(false))
expect(result.current.focusPoints).not.toBe(frame)
})
+
+ it('FE-MAP-TRO-014: opening another trip with the overview on publishes a fresh frame', async () => {
+ // Same days and stops on purpose: only the trip changed, so nothing but the trip
+ // switch itself can be what asks the map to frame again.
+ const { result, rerender } = renderHook(
+ ({ tripId }: { tripId: number }) =>
+ useTripRouteOverview(tripId, DAYS, ASSIGNMENTS, [], [], 'driving', true),
+ { initialProps: { tripId: 7 } },
+ )
+ await waitFor(() => expect(result.current.loading).toBe(false))
+ const frame = result.current.focusPoints
+
+ rerender({ tripId: 8 })
+
+ await waitFor(() => expect(result.current.focusPoints).not.toBe(frame))
+ await waitFor(() => expect(result.current.loading).toBe(false))
+ expect(result.current.focusPoints).toEqual(frame)
+ })
})