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(reservations): pick the confirm button without Array.at, which the ES2020 lib lacks

Maurice9f5e33229324
diff --git a/client/src/components/Planner/ReservationsPanel.test.tsx b/client/src/components/Planner/ReservationsPanel.test.tsx
index 5942d16c5..f8681567d 100644
--- a/client/src/components/Planner/ReservationsPanel.test.tsx
+++ b/client/src/components/Planner/ReservationsPanel.test.tsx
@@ -34,7 +34,10 @@ const defaultProps = {
};
/** The question a delete asks sits in its own portal; its Delete is the last one on the page. */
-const confirmDeleteButton = () => screen.getAllByRole('button', { name: 'Delete' }).at(-1)!;
+const confirmDeleteButton = () => {
+ const buttons = screen.getAllByRole('button', { name: 'Delete' });
+ return buttons[buttons.length - 1];
+};
/** A card's head band carries its own Edit and Delete, named by their tooltips. */
const cardAction = (title: string, name: 'Edit' | 'Delete') =>