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(share): cover the translated untitled-day label (#1296)

Maurice8c63235cd21c
diff --git a/client/src/pages/SharedTripPage.test.tsx b/client/src/pages/SharedTripPage.test.tsx
index 7b6c9119c..84840e50f 100644
--- a/client/src/pages/SharedTripPage.test.tsx
+++ b/client/src/pages/SharedTripPage.test.tsx
@@ -3,7 +3,9 @@ import { render, screen, waitFor, fireEvent } from '../../tests/helpers/render';
import { Routes, Route } from 'react-router-dom';
import { http, HttpResponse } from 'msw';
import { server } from '../../tests/helpers/msw/server';
-import { resetAllStores } from '../../tests/helpers/store';
+import { resetAllStores, seedStore } from '../../tests/helpers/store';
+import { buildSettings } from '../../tests/helpers/factories';
+import { useSettingsStore } from '../store/settingsStore';
import SharedTripPage from './SharedTripPage';
// Mock react-leaflet (SharedTripPage renders a map)
@@ -480,4 +482,31 @@ describe('SharedTripPage', () => {
expect(screen.getByText(/LH2/)).toBeInTheDocument();
});
});
+
+ describe('FE-PAGE-SHARED-018: untitled day uses the translated day label (#1296)', () => {
+ it('renders the day-number label via i18n (German), not a hardcoded English string', async () => {
+ seedStore(useSettingsStore, { settings: buildSettings({ language: 'de' }) });
+ const day = { id: 101, trip_id: 1, day_number: 1, date: '2026-07-01', title: null, notes: null };
+ server.use(
+ http.get('/api/shared/:token', () => HttpResponse.json({
+ trip: { id: 1, title: 'Shared Paris Trip', start_date: '2026-07-01', end_date: '2026-07-05' },
+ days: [day],
+ assignments: {},
+ dayNotes: {},
+ places: [],
+ reservations: [],
+ accommodations: [],
+ packing: [],
+ budget: [],
+ categories: [],
+ permissions: { share_bookings: false, share_packing: false, share_budget: false, share_collab: false },
+ collab: [],
+ })),
+ );
+ renderSharedTrip('test-token');
+ // The untitled day shows the German label "Tag 1", proving the hardcoded English
+ // "Day 1" was replaced by the i18n key t('dayplan.dayN').
+ await waitFor(() => expect(screen.getByText('Tag 1')).toBeInTheDocument());
+ });
+ });
});