From 43f86f45595bc2802ad03efdc3b2b7f8f87542c6 Mon Sep 17 00:00:00 2001 From: Maurice Date: Sat, 7 Nov 2026 00:12:56 +0100 Subject: [PATCH] test(booking-import): the per-leg seat tests pass the type check of the tests An object literal with airplaneSeat inside the legs() call failed the excess property check of tsconfig.tests.json; the nodes are built as constants first, as the other seat tests do. --- .../booking-import/kitineraryMapper.test.ts | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/server/tests/unit/nest/booking-import/kitineraryMapper.test.ts b/server/tests/unit/nest/booking-import/kitineraryMapper.test.ts index 71d5db5e8..c7b3e1313 100644 --- a/server/tests/unit/nest/booking-import/kitineraryMapper.test.ts +++ b/server/tests/unit/nest/booking-import/kitineraryMapper.test.ts @@ -657,25 +657,26 @@ describe('kitinerary mapper: the seat as KItinerary writes it', () => { describe('kitinerary mapper: the seat on each leg of a connecting flight', () => { it('keeps every leg its own seat', () => { - const { items } = mapReservations( - legs( - { ...flight('ABC123', FRA, BER, '2026-06-11T10:00:00', '2026-06-11T12:00:00', 'LH 100'), airplaneSeat: '12C' }, - { ...flight('ABC123', BER, HND, '2026-06-11T14:30:00', '2026-06-11T23:30:00', 'LH 200'), airplaneSeat: '40A' }, - ), - 'test.json', - ); + const first = { + ...flight('ABC123', FRA, BER, '2026-06-11T10:00:00', '2026-06-11T12:00:00', 'LH 100'), + airplaneSeat: '12C', + }; + const second = { + ...flight('ABC123', BER, HND, '2026-06-11T14:30:00', '2026-06-11T23:30:00', 'LH 200'), + airplaneSeat: '40A', + }; + const { items } = mapReservations(legs(first, second), 'test.json'); const legsMeta = (items[0].metadata as { legs: { seat?: string }[] }).legs; expect(legsMeta.map((leg) => leg.seat)).toEqual(['12C', '40A']); }); it('leaves the seat off a leg that has none', () => { - const { items } = mapReservations( - legs(flight('ABC123', FRA, BER, '2026-06-11T10:00:00', '2026-06-11T12:00:00', 'LH 100'), { - ...flight('ABC123', BER, HND, '2026-06-11T14:30:00', '2026-06-11T23:30:00', 'LH 200'), - airplaneSeat: '40A', - }), - 'test.json', - ); + const first = flight('ABC123', FRA, BER, '2026-06-11T10:00:00', '2026-06-11T12:00:00', 'LH 100'); + const second = { + ...flight('ABC123', BER, HND, '2026-06-11T14:30:00', '2026-06-11T23:30:00', 'LH 200'), + airplaneSeat: '40A', + }; + const { items } = mapReservations(legs(first, second), 'test.json'); const legsMeta = (items[0].metadata as { legs: Record[] }).legs; expect(legsMeta[0]).not.toHaveProperty('seat'); expect(legsMeta[1]).toMatchObject({ seat: '40A' });