From 6c6e285c3dd44080ee37ee386b304095aafa23fa Mon Sep 17 00:00:00 2001 From: Maurice Date: Tue, 20 Oct 2026 21:11:43 +0200 Subject: [PATCH] test(tours): expect the time estimate on imported tours and hikes without a time Since the estimate rule, an import without its own time shows the worked-out estimate on the day plan tile, and the sidebar metrics lead with it. Add the estimate field to the RS-01 fixture. --- client/src/components/Planner/DayPlanSidebar.tours.test.tsx | 6 +++++- client/src/components/Tours/ToursSidebar.test.tsx | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/client/src/components/Planner/DayPlanSidebar.tours.test.tsx b/client/src/components/Planner/DayPlanSidebar.tours.test.tsx index b50a2e2b5..2618560d1 100644 --- a/client/src/components/Planner/DayPlanSidebar.tours.test.tsx +++ b/client/src/components/Planner/DayPlanSidebar.tours.test.tsx @@ -188,6 +188,7 @@ describe('DayPlanSidebar', () => { manuallyOverridden: false, walk: null, atLeast: false, + estimate: null, }; const props = makeDefaultProps({ days: [day], @@ -322,7 +323,10 @@ describe('DayPlanSidebar', () => { render(); expect(screen.getByTestId('plan-tour-icon').querySelector('.lucide-mountain')).toBeTruthy(); - expect(screen.queryByTestId('trip-plan-tour-time')).not.toBeInTheDocument(); + // TIME-01: without a time of its own the import shows its estimate, worked out from its measures. + const time = screen.getByTestId('trip-plan-tour-time'); + expect(time).toHaveTextContent('≈ 2 h 21 min'); + expect(time).toHaveAccessibleName(expect.stringContaining('Estimated time: 2 h 21 min')); }); it('RC-01: a tour row offers no booking, a tour is not booked', () => { diff --git a/client/src/components/Tours/ToursSidebar.test.tsx b/client/src/components/Tours/ToursSidebar.test.tsx index 052f01cac..b6644fcba 100644 --- a/client/src/components/Tours/ToursSidebar.test.tsx +++ b/client/src/components/Tours/ToursSidebar.test.tsx @@ -123,8 +123,10 @@ describe('ToursSidebar', () => { expect(metrics).toHaveTextContent('1.9 km') expect(metrics).toHaveTextContent('13 m') const labels = [...metrics.querySelectorAll('[aria-label]')].map(element => element.getAttribute('aria-label')) - expect(labels[0]).toContain('1.9 km') - expect(labels[1]).toContain('13 m') + // TIME-01: a hike without a time of its own leads with its estimate, then distance and climbing. + expect(labels[0]).toMatch(/(Estimated time|Geschätzte Zeit): 30 min/) + expect(labels[1]).toContain('1.9 km') + expect(labels[2]).toContain('13 m') expect(within(row).queryByText('TREK')).not.toBeInTheDocument() expect(screen.getByLabelText(/Maximum trail difficulty|Maximale Wanderschwierigkeit|T2/)).toBeInTheDocument() const actionRow = row.querySelector('[data-testid="tour-action-row"]')!