Files
KArtSell.Aegis/docs/Design/kbx-foundation-v60-status-canonical-contract-hardening/tests/unit/kbx-order-status-canonical.contract.spec.ts
T
kjh2064 3f293d8aa8
deploy / deploy (push) Successful in 1m52s
deploy / notify (push) Successful in 1s
V13-FE-006: consolidate approved UI and contract hardening
2026-08-13 02:41:00 +09:00

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()
})
})