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.

fix(bookings): client test failures after map overlay refactor

Maurice5e9c8d2c4309
diff --git a/client/src/components/Map/MapView.test.tsx b/client/src/components/Map/MapView.test.tsx
index 36ee48691..af0b54493 100644
--- a/client/src/components/Map/MapView.test.tsx
+++ b/client/src/components/Map/MapView.test.tsx
@@ -32,6 +32,7 @@ vi.mock('react-leaflet', () => ({
off: vi.fn(),
panBy: vi.fn(),
}),
+ useMapEvents: () => ({}),
}))
vi.mock('react-leaflet-cluster', () => ({
diff --git a/client/src/components/Map/ReservationOverlay.tsx b/client/src/components/Map/ReservationOverlay.tsx
index 74b417144..09e27703c 100644
--- a/client/src/components/Map/ReservationOverlay.tsx
+++ b/client/src/components/Map/ReservationOverlay.tsx
@@ -25,6 +25,7 @@ const TYPE_META: Record<TransportType, { color: string; icon: typeof Plane; geod
function useEndpointPane() {
const map = useMap()
useMemo(() => {
+ if (typeof map?.getPane !== 'function' || typeof map?.createPane !== 'function') return
if (!map.getPane(ENDPOINT_PANE)) {
const pane = map.createPane(ENDPOINT_PANE)
pane.style.zIndex = '650'
diff --git a/client/src/components/Planner/ReservationModal.test.tsx b/client/src/components/Planner/ReservationModal.test.tsx
index 0ec10cdfa..c5bcfbaab 100644
--- a/client/src/components/Planner/ReservationModal.test.tsx
+++ b/client/src/components/Planner/ReservationModal.test.tsx
@@ -575,16 +575,14 @@ describe('ReservationModal', () => {
expect(screen.queryByPlaceholderText('0.00')).not.toBeInTheDocument();
});
- it('FE-PLANNER-RESMODAL-042: flight type metadata saved with airline and airports', async () => {
+ it('FE-PLANNER-RESMODAL-042: flight type metadata saved with airline and flight number', async () => {
const onSave = vi.fn().mockResolvedValue(undefined);
render(<ReservationModal {...defaultProps} onSave={onSave} />);
await userEvent.click(screen.getByRole('button', { name: /Flight/i }));
- await userEvent.type(screen.getByPlaceholderText(/e\.g\. Lufthansa/i), 'AF 447');
+ await userEvent.type(screen.getByPlaceholderText(/e\.g\. Lufthansa/i), 'AF 447 CDG → JFK');
await userEvent.type(screen.getByPlaceholderText('Lufthansa'), 'Air France');
await userEvent.type(screen.getByPlaceholderText('LH 123'), 'AF 447');
- await userEvent.type(screen.getByPlaceholderText('FRA'), 'CDG');
- await userEvent.type(screen.getByPlaceholderText('NRT'), 'JFK');
await userEvent.click(screen.getByRole('button', { name: /^Add$/i }));
@@ -595,8 +593,6 @@ describe('ReservationModal', () => {
metadata: expect.objectContaining({
airline: 'Air France',
flight_number: 'AF 447',
- departure_airport: 'CDG',
- arrival_airport: 'JFK',
}),
})
);