import assert from 'node:assert/strict' import { readFileSync } from 'node:fs' import { test } from 'node:test' const productionFixtures = [ 'manual-state-loading-pda.mjs', 'ocean-booking-fixture.mjs', 'ocean-bookings.mjs', 'phase3-carrier-schedule-queries.mjs', 'phase3-container-loading.mjs', 'phase3-loading.mjs', 'phase3-order-splitting.mjs', 'phase3-port-schedules.mjs', ] function source(name) { return readFileSync(new URL(name, import.meta.url), 'utf8') } test('HTTP fixtures use the canonical primary and mismatch container specifications', () => { const primarySources = productionFixtures.map(source).join('\n') const containerFlow = source('phase3-container-loading.mjs') assert.match(primarySources, /containerType: '40HQ'[\s\S]*?capacityCbm: 68[\s\S]*?maxWeightKg: 19500/) assert.match(containerFlow, /containerType: '40GP'[\s\S]*?capacityCbm: 58[\s\S]*?maxWeightKg: 19500/) }) test('HTTP fixtures do not reintroduce retired aliases or arbitrary specifications', () => { for (const name of productionFixtures) { const fixture = source(name) assert.doesNotMatch(fixture, /20GP|40HC|40NR|45HC/, name) assert.doesNotMatch(fixture, /capacityCbm:\s*(?:100|76|67|33|28)(?:\D|$)/, name) assert.doesNotMatch(fixture, /maxWeightKg:\s*(?:100000|22000)(?:\D|$)/, name) } }) test('the frozen catalog is complete and unambiguous', () => { // Keep every future fixture producer constrained to the same product catalog as Admin and Firstleg. const catalog = Object.freeze({ '40GP': Object.freeze({ capacityCbm: 58, maxWeightKg: 19500 }), '40HQ': Object.freeze({ capacityCbm: 68, maxWeightKg: 19500 }), '45HQ': Object.freeze({ capacityCbm: 86, maxWeightKg: 19500 }), }) assert.deepEqual(Object.keys(catalog), ['40GP', '40HQ', '45HQ']) assert.equal(new Set(Object.keys(catalog)).size, 3) })