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(tours): read the last undo without Array.at, which the client lib does not offer

Mauricea8e2486cd385
diff --git a/client/src/pages/tripPlanner/useTourDayChoice.test.ts b/client/src/pages/tripPlanner/useTourDayChoice.test.ts
index eaeeb442e..59dea846a 100644
--- a/client/src/pages/tripPlanner/useTourDayChoice.test.ts
+++ b/client/src/pages/tripPlanner/useTourDayChoice.test.ts
@@ -81,7 +81,10 @@ function writesThatLand() {
}
const render = () => renderHook(() => useTourDayChoice(options));
-const lastUndo = () => vi.mocked(options.pushUndo).mock.calls.at(-1)?.[1] as Undo;
+const lastUndo = () => {
+ const calls = vi.mocked(options.pushUndo).mock.calls;
+ return calls[calls.length - 1]?.[1] as Undo;
+};
describe('useTourDayChoice', () => {
it('FE-TOUR-STAGE-SPREAD-010: a place, a day tour and a tour put whole on purpose go on at once', async () => {