import { describe, expect, it } from 'vitest' import { SMART_LOADING_CHANNEL_GROUPS, SMART_LOADING_WAREHOUSE_GROUPS, resolveSmartLoadingChannelGroup, resolveSmartLoadingWarehouseGroup, } from './smartLoadingChannelGroups' describe('smartLoadingChannelGroups', () => { it('exposes the nine confirmed display groups in a fixed order', () => { expect(SMART_LOADING_CHANNEL_GROUPS.map((group) => group.name)).toEqual([ '美森正班', '美森加班', 'EXX', '合德', '洛杉矶普船', '芝加哥普船', '休斯顿普船', '萨凡纳普船', '纽约普船海卡', ]) }) it.each([ ['MATSON_CLX_TRUCK', '美森正班海卡', '美森正班'], ['MATSON_CLX_PARCEL', '美森正班海派', '美森正班'], ['BYHP', '美森加班海派', '美森加班'], ['EXX_RAIL_NY', '纽约EXX海铁', 'EXX'], ['HDHK', '合德海卡包税', '合德'], ['OA_LA_FULL_TRUCK', '洛杉矶普船全卡', '洛杉矶普船'], ['OA_PARCEL', '普船海派', '洛杉矶普船'], ['CPHT', '芝加哥普船海铁', '芝加哥普船'], ['HPHK', '休斯顿普船海卡', '休斯顿普船'], ['SPHK', '萨凡纳普船海卡', '萨凡纳普船'], ['NPHK', '纽约普船海卡', '纽约普船海卡'], ])('maps %s / %s into %s', (channelCode, channelName, expected) => { expect(resolveSmartLoadingChannelGroup(channelCode, channelName)?.name).toBe(expected) }) it('does not leak an unconfirmed channel into the fixed display groups', () => { expect(resolveSmartLoadingChannelGroup('UNKNOWN', '未确认新渠道')).toBeNull() }) it('exposes Yiwu and Dongguan as the fixed top-level warehouses', () => { expect(SMART_LOADING_WAREHOUSE_GROUPS.map((group) => group.name)).toEqual(['义乌仓', '东莞仓']) expect(resolveSmartLoadingWarehouseGroup('义乌国内仓')?.code).toBe('YIWU') expect(resolveSmartLoadingWarehouseGroup('东莞仓')?.code).toBe('DONGGUAN') expect(resolveSmartLoadingWarehouseGroup('其他仓')).toBeNull() }) })