Files
admin-web/src/modules/container-loading/containerChannelLabel.test.ts
T

18 lines
1.0 KiB
TypeScript
Raw Normal View History

import { describe, expect, it } from 'vitest'
import { containerChannelLabel } from './containerChannelLabel'
describe('container actual channel label', () => {
it('preserves the supplied channel name regardless of booking linkage', () => {
expect(containerChannelLabel({ channelName: '纽约海铁', oceanBookingId: '123' })).toBe('纽约海铁')
expect(containerChannelLabel({ channelName: '纽约海铁', oceanBookingId: null })).toBe('纽约海铁')
})
it('does not describe a linked booking as unlinked when the channel is absent', () => {
expect(containerChannelLabel({ channelName: null, oceanBookingId: '123' })).toBe('—')
expect(containerChannelLabel({ channelName: '', oceanBookingId: '123' })).toBe('—')
})
it('shows pending linkage only when both channel and booking are absent', () => {
expect(containerChannelLabel({ channelName: null, oceanBookingId: null })).toBe('待关联订舱')
expect(containerChannelLabel({ channelName: '', oceanBookingId: undefined })).toBe('待关联订舱')
})
})