Add CARING examples and coverage
Some checks failed
CI / Build and Test (push) Has been cancelled
CI / Lint (push) Has been cancelled

This commit is contained in:
2026-05-17 06:05:18 +02:00
parent 49655e40e0
commit 18054bd160
10 changed files with 318 additions and 1 deletions

View File

@@ -30,6 +30,32 @@ func TestRegistryManifestsParse(t *testing.T) {
}
}
func TestExpandedRegistryExamplesParse(t *testing.T) {
var subjects api.SubjectManifest
loadYAML(t, filepath.Join("..", "..", "examples", "caring", "team_subject_manifest.yaml"), &subjects)
if len(subjects.Teams) != 1 || subjects.Teams[0].ID != "team:project-reviewers" {
t.Fatalf("subjects.Teams = %+v; want team:project-reviewers", subjects.Teams)
}
var resources api.ResourceManifest
loadYAML(t, filepath.Join("..", "..", "examples", "caring", "project_resource_manifest.yaml"), &resources)
if len(resources.Resources) != 2 || resources.Resources[1].Parent != "project:alpha-redesign" {
t.Fatalf("resources = %+v; want document inheriting from project", resources.Resources)
}
var relationships []api.RelationshipFact
loadYAML(t, filepath.Join("..", "..", "examples", "caring", "inherited_relationships.yaml"), &relationships)
if len(relationships) != 2 {
t.Fatalf("relationships len = %d; want 2", len(relationships))
}
if relationships[0].Caring == nil || relationships[0].Caring.CanonicalRole != api.CanonicalRoleVerifier {
t.Fatalf("relationships[0].Caring = %+v; want Verifier descriptor", relationships[0].Caring)
}
if relationships[1].Relation != "inherits" {
t.Fatalf("relationships[1].Relation = %q; want inherits", relationships[1].Relation)
}
}
func loadYAML(t *testing.T, path string, out any) {
t.Helper()