Files
admin-web/src/modules/overseas-warehouse/smartDispatchWarehouseTab.test.ts
T
2026-10-19 17:56:31 +08:00

22 lines
1.0 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { matchesSmartDispatchWarehouseTab } from './smartDispatchWarehouseTab'
describe('smart dispatch warehouse tabs', () => {
it('uses the overseas warehouse code when the warehouse name is unavailable', () => {
const losAngeles = { warehouseCode: 'US-LAX-01', warehouseName: '' }
const newYork = { warehouseCode: 'US-NY-01', warehouseName: '' }
expect(matchesSmartDispatchWarehouseTab(losAngeles, 'LAX')).toBe(true)
expect(matchesSmartDispatchWarehouseTab(losAngeles, 'NYC')).toBe(false)
expect(matchesSmartDispatchWarehouseTab(newYork, 'NYC')).toBe(true)
expect(matchesSmartDispatchWarehouseTab(newYork, 'LAX')).toBe(false)
})
it('keeps the all tab unfiltered and supports warehouse names as a fallback', () => {
const warehouse = { warehouseCode: '', warehouseName: '洛杉矶接柜仓' }
expect(matchesSmartDispatchWarehouseTab(warehouse, 'ALL')).toBe(true)
expect(matchesSmartDispatchWarehouseTab(warehouse, 'LAX')).toBe(true)
})
})