Files
KArtSell.Aegis/docs/Design/kbx-foundation-v52-fe-operational-navigation-screen-anatomy/tests/unit/kbx-lookup.contract.spec.ts
T
kjh2064 c41e5063b7 chore: remove kbx-foundation-v36 reference (superseded by v4 implementation)
Removed entire kbx-foundation-v36 directory as it's been replaced by
the new KBX Foundation v4 patterns implemented in this session:
- Registry-driven screen definitions
- Density-aware UI adapter components
- Feature module templates (ShadowRun, Models)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-08-12 01:39:58 +09:00

26 lines
1001 B
TypeScript

import { describe, expect, it } from 'vitest'
import type { KbxLookupProvider } from '@kbx/contracts'
const provider: KbxLookupProvider<string> = {
async search(request) {
return { items: [{ id: '1', code: '10001', displayName: '대한상사' }], totalCount: 1 }
},
async resolveById(id) {
return id === '1' ? { id: '1', code: '10001', displayName: '대한상사' } : null
},
async resolveByCode(code) {
return code === '10001' ? { id: '1', code: '10001', displayName: '대한상사' } : null
},
}
describe('KbxLookup provider contract', () => {
it('never invents an entity: unknown code resolves null', async () => {
expect(await provider.resolveByCode('UNKNOWN')).toBeNull()
})
it('search returns stable domain id + code + displayName', async () => {
const result = await provider.search({ query: '대한', page: 1, pageSize: 30 })
expect(result.items[0]).toEqual(expect.objectContaining({ id: '1', code: '10001', displayName: '대한상사' }))
})
})