From ef8bda8683bba456d5d995b815ca4dfb75e543a0 Mon Sep 17 00:00:00 2001 From: gnezim Date: Tue, 5 May 2026 21:48:14 +0300 Subject: [PATCH] Fix schedule buy links in grouped results --- .../components/DayGroupedFlightList.test.tsx | 26 +++++++++++++++++++ .../components/DayGroupedFlightList.tsx | 1 + 2 files changed, 27 insertions(+) diff --git a/src/features/schedule/components/DayGroupedFlightList.test.tsx b/src/features/schedule/components/DayGroupedFlightList.test.tsx index c54a77bd..f834e6aa 100644 --- a/src/features/schedule/components/DayGroupedFlightList.test.tsx +++ b/src/features/schedule/components/DayGroupedFlightList.test.tsx @@ -278,6 +278,32 @@ describe("schedule search results body โ€” action strip", () => { }); }); +describe("schedule search results โ€” inline buy link", () => { + it("threads buyUrlFor into grouped multi-day FlightList rows", () => { + const firstDay = makeDirectFlight({ + depLocal: "2026-05-06T08:00:00+03:00", + arrLocal: "2026-05-06T10:30:00+03:00", + }); + const secondDay = makeDirectFlight({ + depLocal: "2026-05-07T14:00:00+03:00", + arrLocal: "2026-05-07T16:30:00+03:00", + }); + + render( + `https://example.test/buy/${flight.id}`} + />, + ); + + const firstBuyLink = screen.getByTestId("flight-card-buy-link"); + expect(firstBuyLink.getAttribute("href")).toBe("https://example.test/buy/f-first-day"); + }); +}); + // --------------------------------------------------------------------------- // ยง4.1.14.3 โ€” DayGroupedFlightList grouping + day headers // --------------------------------------------------------------------------- diff --git a/src/features/schedule/components/DayGroupedFlightList.tsx b/src/features/schedule/components/DayGroupedFlightList.tsx index 0e1e6d8e..67cfc654 100644 --- a/src/features/schedule/components/DayGroupedFlightList.tsx +++ b/src/features/schedule/components/DayGroupedFlightList.tsx @@ -363,6 +363,7 @@ export const DayGroupedFlightList: FC = ({ direction="schedule" renderExpandedBody={renderScheduleBody} {...(onFlightClick ? { onFlightClick } : {})} + {...(buyUrlFor ? { buyUrlFor } : {})} {...(resolvedInitialFlightId ? { initialCurrentFlightId: resolvedInitialFlightId } : {})}