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.

1.0 KB
Raw Blame
// 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');
  });
});