24 lines
1.3 KiB
TypeScript
24 lines
1.3 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { resolveKbxGridStatus } from '@kbx/ui'
|
|
import { kbxStatusCatalog, kbxStatusOptions, normalizeKbxStatusValue } from '../../apps/web/src/registry/statusCatalog'
|
|
|
|
describe('OMS order status canonical contract', () => {
|
|
it('keeps the API value canonical while presenting a familiar Korean label', () => {
|
|
const resolved = resolveKbxGridStatus({ definitions:kbxStatusCatalog.orderLifecycle }, 'DRAFT')
|
|
expect(resolved).toMatchObject({ rawValue:'DRAFT', label:'작성', semantic:'draft', unknown:false })
|
|
})
|
|
|
|
it('derives shipment search options from the same dictionary used by the grid', () => {
|
|
const options = kbxStatusOptions(kbxStatusCatalog.orderShipment)
|
|
expect(options).toContainEqual({ value:'READY', label:'출고대기' })
|
|
expect(options).toContainEqual({ value:'ERROR', label:'오류' })
|
|
expect(options.some(option => option.value === '출고대기')).toBe(false)
|
|
})
|
|
|
|
it('rejects display labels and unknown values as persisted canonical filters', () => {
|
|
expect(normalizeKbxStatusValue(kbxStatusCatalog.orderShipment, 'READY')).toBe('READY')
|
|
expect(normalizeKbxStatusValue(kbxStatusCatalog.orderShipment, '출고대기')).toBeNull()
|
|
expect(normalizeKbxStatusValue(kbxStatusCatalog.orderShipment, 'NEW_VENDOR_STATE')).toBeNull()
|
|
})
|
|
})
|