refactor(planner): share the transport detail day and segment labels between desktop and phone

The transport detail dialog and the phone transport sheet name the booking's day and each segment's own booking code through transportDetailModel, next to the files filter they already share. The rest of the two views reads the booking differently on purpose and stays as it is.
This commit is contained in:
Maurice
2026-10-09 10:48:31 +02:00
parent fc3cc1bbbe
commit a4e3e83d3f
4 changed files with 52 additions and 11 deletions
@@ -0,0 +1,21 @@
// FE-PLANNER-TRANSPORTDETAIL-001 to -002: the labels the desktop transport detail
// and the phone transport sheet both read off a booking.
import { describe, expect, it } from 'vitest';
import { bookingDayLabel, segmentCodeLabel } from './transportDetailModel';
const t = (key: string) => `t:${key}`;
describe('transportDetailModel', () => {
it('FE-PLANNER-TRANSPORTDETAIL-001: the day reads as weekday, day and month, on the calendar date itself', () => {
expect(bookingDayLabel('2026-07-01', 'en-US')).toBe('Wed, Jul 1');
expect(bookingDayLabel('2026-12-31', 'en-US')).toBe('Thu, Dec 31');
});
it('FE-PLANNER-TRANSPORTDETAIL-002: a segment code is listed under its route, or the plain code label', () => {
expect(segmentCodeLabel({ from: 'MUC', to: 'FRA' }, t)).toBe('MUC → FRA');
expect(segmentCodeLabel({ from: 'MUC', to: null }, t)).toBe('MUC');
expect(segmentCodeLabel({ to: 'FRA' }, t)).toBe('FRA');
expect(segmentCodeLabel({ from: null, to: '' }, t)).toBe('t:reservations.confirmationCode');
});
});