import { describe, expect, it } from 'vitest'
import type { KbxGridStatusMap } from '@kbx/contracts'
import { resolveKbxGridStatus } from '@kbx/ui'

const map:KbxGridStatusMap={definitions:[
  {value:'READY',label:'출고대기',semantic:'ready'},
  {value:'BLOCKED',label:'예외',semantic:'error'},
]}

describe('KBX grid status mapping',()=>{
  it('keeps canonical raw value while returning the user label',()=>{
    expect(resolveKbxGridStatus(map,'READY')).toEqual({rawValue:'READY',label:'출고대기',semantic:'ready',unknown:false})
  })
  it('fails visibly for unknown domain values',()=>{
    expect(resolveKbxGridStatus(map,'NEW_VENDOR_STATE')).toEqual({rawValue:'NEW_VENDOR_STATE',label:'정의되지 않음 · NEW_VENDOR_STATE',semantic:'warning',unknown:true})
  })
})
