import { describe, expect, it } from 'vitest'
import { kbxTemplateManifest } from '@kbx/ui'

describe('KBX template state matrix',()=>{
  it('requires explicit idle/runtime/permission states where applicable',()=>{
    const byCode=new Map(kbxTemplateManifest.map(item=>[item.code,item]))
    expect(byCode.get('T01')?.runtimeStates).toContain('idle')
    for(const template of kbxTemplateManifest)expect(template.stateCapabilities).toContain('permission')
    expect(byCode.get('T02')?.stateCapabilities).toEqual(expect.arrayContaining(['dirty','conflict']))
    expect(byCode.get('T03')?.stateCapabilities).toEqual(expect.arrayContaining(['dirty','conflict','validation']))
    expect(byCode.get('T04')?.stateCapabilities).toContain('validation')
    expect(byCode.get('T08')?.stateCapabilities).toContain('job')
    expect(byCode.get('T09')?.stateCapabilities).toContain('network')
  })
})
