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

describe('KBX screen recipes',()=>{
  it('closes every T01-T09 template to an implementation and verification recipe',()=>{
    expect(Object.keys(kbxScreenRecipeCatalog)).toHaveLength(9)
    for(const template of kbxTemplateManifest){
      const recipe=kbxScreenRecipeCatalog[template.code]
      const verification=kbxScreenRecipeVerificationCatalog[template.code]
      expect(recipe.type).toBe(template.type)
      expect(recipe.templateComponent).toBe(template.component)
      expect(recipe.requiredPolicies.length).toBeGreaterThan(0)
      expect(recipe.recoveryPolicies.length).toBeGreaterThan(0)
      expect(recipe.securityPolicies.length).toBeGreaterThan(0)
      expect(recipe.canonicalScenarioIds.length).toBeGreaterThan(0)
      expect(recipe.testProfile.requiredChecks.length).toBeGreaterThan(0)
      expect(recipe.testProfile.requiredScenarioKinds).toContain('e2e')
      expect(verification.complete).toBe(true)
      expect(verification.missingScenarioKinds).toEqual([])
      expect(verification.missingTags).toEqual([])
      expect(verification.missingEvidence).toEqual([])
    }
  })
})
