c41e5063b7
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>
23 lines
963 B
TypeScript
23 lines
963 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { isKbxProblem, kbxApiCatalog } from '@kbx/contracts'
|
|
|
|
describe('KBX API contract', () => {
|
|
it('keeps operation IDs and routes unique', () => {
|
|
const operations = Object.values(kbxApiCatalog)
|
|
expect(new Set(operations.map(x => x.id)).size).toBe(operations.length)
|
|
expect(new Set(operations.map(x => `${x.method} ${x.path}`)).size).toBe(operations.length)
|
|
})
|
|
|
|
it('requires a stable key only for mutation operations', () => {
|
|
const required = Object.values(kbxApiCatalog).filter(x => x.idempotency === 'required')
|
|
expect(required.length).toBeGreaterThan(0)
|
|
expect(required.every(x => x.method !== 'GET')).toBe(true)
|
|
})
|
|
|
|
it('recognizes the public problem discriminator family', () => {
|
|
for (const type of ['validation','business-rule','conflict','permission','not-found','integration','system']) {
|
|
expect(isKbxProblem({ type, title: 'test' })).toBe(true)
|
|
}
|
|
})
|
|
})
|