Complete assembled validation and migrate remaining tests

This commit is contained in:
2026-11-10 18:13:12 +00:00
parent ba1d5d2367
commit 2844ce7e6a
44 changed files with 577 additions and 1624 deletions

View File

@@ -7,6 +7,7 @@ import (
"testing"
"gitea.maximumdirect.net/eric/audita/v3/internal/core/chunking"
"gitea.maximumdirect.net/eric/audita/v3/internal/core/config"
"gitea.maximumdirect.net/eric/audita/v3/internal/framework/proposals"
"gitea.maximumdirect.net/eric/audita/v3/internal/framework/validators"
)
@@ -80,28 +81,14 @@ func TestInterfaceContractsCompileWithFakes(t *testing.T) {
}
func TestResolveModuleRunSpecs(t *testing.T) {
specs, err := ResolveModuleRunSpecs([]string{"glossary", "homophones", "glossary", "spoken_word", "grammar"})
if err != nil {
t.Fatalf("unexpected error: %v", err)
id := "named"
cfg := &config.Config{Pipeline: config.Pipeline{Stages: []config.Stage{{Module: "glossary", ID: &id}, {Module: "grammar"}, {Module: "glossary"}}}}
specs := ResolveModuleRunSpecs(cfg)
if len(specs) != 3 || specs[0].Index != 0 || specs[0].ID == nil || *specs[0].ID != id || specs[0].InstanceName != "glossary_1" || specs[1].InstanceName != "grammar_2" || specs[2].InstanceName != "glossary_3" {
t.Fatalf("unexpected specs: %+v", specs)
}
expected := []ModuleRunSpec{
{ModuleKey: "glossary", InstanceName: "glossary_1"},
{ModuleKey: "homophones", InstanceName: "homophones"},
{ModuleKey: "glossary", InstanceName: "glossary_2"},
{ModuleKey: "spoken_word", InstanceName: "spoken_word"},
{ModuleKey: "grammar", InstanceName: "grammar"},
}
if !reflect.DeepEqual(specs, expected) {
t.Fatalf("unexpected specs\nexpected: %+v\nactual: %+v", expected, specs)
}
}
func TestResolveModuleRunSpecsRejectsEmptyKey(t *testing.T) {
_, err := ResolveModuleRunSpecs([]string{"glossary", ""})
if err == nil {
t.Fatal("expected error for empty module key")
if len(ResolveModuleRunSpecs(nil)) != 0 {
t.Fatal("nil configuration has run specs")
}
}