This commit is contained in:
2026-09-15 10:37:34 +08:00
parent 4f13ee2ec3
commit 88e2fb0eb1
49 changed files with 465 additions and 236 deletions
@@ -21,15 +21,15 @@ test('HTTP fixtures use the canonical primary and mismatch container specificati
const primarySources = productionFixtures.map(source).join('\n')
const containerFlow = source('phase3-container-loading.mjs')
assert.match(primarySources, /containerType: '40HC'[\s\S]*?capacityCbm: 76[\s\S]*?maxWeightKg: 28000/)
assert.match(containerFlow, /containerType: '20GP'[\s\S]*?capacityCbm: 33[\s\S]*?maxWeightKg: 28000/)
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, /40HQ|45HQ/, name)
assert.doesNotMatch(fixture, /capacityCbm:\s*(?:100|68|28)(?:\D|$)/, 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)
}
})
@@ -37,13 +37,11 @@ test('HTTP fixtures do not reintroduce retired aliases or arbitrary specificatio
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({
'20GP': Object.freeze({ capacityCbm: 33, maxWeightKg: 28000 }),
'40GP': Object.freeze({ capacityCbm: 67, maxWeightKg: 28000 }),
'40HC': Object.freeze({ capacityCbm: 76, maxWeightKg: 28000 }),
'40NR': Object.freeze({ capacityCbm: 67, maxWeightKg: 28000 }),
'45HC': Object.freeze({ capacityCbm: 86, maxWeightKg: 28000 }),
'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), ['20GP', '40GP', '40HC', '40NR', '45HC'])
assert.equal(new Set(Object.keys(catalog)).size, 5)
assert.deepEqual(Object.keys(catalog), ['40GP', '40HQ', '45HQ'])
assert.equal(new Set(Object.keys(catalog)).size, 3)
})