Complete assembled validation and migrate remaining tests
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/core/schema"
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/core/glossary"
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/framework/contracts"
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/framework/proposals"
|
||||
frameworkvalidators "gitea.maximumdirect.net/eric/audita/v3/internal/framework/validators"
|
||||
@@ -27,12 +27,8 @@ func proposal(index int, moduleKey, original, corrected string) proposals.Enrich
|
||||
}
|
||||
}
|
||||
|
||||
func tinyGlossary() *schema.Glossary {
|
||||
return &schema.Glossary{
|
||||
Entries: []schema.GlossaryEntry{
|
||||
{Name: "Jesters", Category: "faction", Summary: "Faction"},
|
||||
},
|
||||
}
|
||||
func tinyGlossary() []glossary.Entry {
|
||||
return []glossary.Entry{{Collection: "party", ID: "jesters", Name: "Jesters", Category: "faction", Description: "Faction"}}
|
||||
}
|
||||
|
||||
func TestNewReportsStableKeyAndDeterministicClass(t *testing.T) {
|
||||
@@ -83,8 +79,9 @@ func TestNewRejectsProtectedTermChangeOutsideGlossaryStage(t *testing.T) {
|
||||
}
|
||||
|
||||
req := contracts.ValidationRequest{
|
||||
ModuleKey: "homophones",
|
||||
Glossary: tinyGlossary(),
|
||||
ModuleKey: "homophones",
|
||||
Glossary: tinyGlossary(),
|
||||
ProtectedTerms: glossary.Vocabulary(tinyGlossary(), nil),
|
||||
CandidateProposal: []proposals.EnrichedCorrectionProposal{
|
||||
proposal(0, "homophones", "Jesters", "Gestures"),
|
||||
},
|
||||
@@ -105,9 +102,9 @@ func TestNewRejectsProtectedTermChangeOutsideGlossaryStage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNewGlossaryStageRejectsProtectedTermChange(t *testing.T) {
|
||||
v, err := NewGlossaryStage()
|
||||
v, err := New()
|
||||
if err != nil {
|
||||
t.Fatalf("NewGlossaryStage: %v", err)
|
||||
t.Fatalf("New: %v", err)
|
||||
}
|
||||
if v.Name() != Key {
|
||||
t.Fatalf("expected key %q, got %q", Key, v.Name())
|
||||
@@ -117,8 +114,9 @@ func TestNewGlossaryStageRejectsProtectedTermChange(t *testing.T) {
|
||||
}
|
||||
|
||||
req := contracts.ValidationRequest{
|
||||
ModuleKey: "glossary",
|
||||
Glossary: tinyGlossary(),
|
||||
ModuleKey: "glossary",
|
||||
Glossary: tinyGlossary(),
|
||||
ProtectedTerms: glossary.Vocabulary(tinyGlossary(), nil),
|
||||
CandidateProposal: []proposals.EnrichedCorrectionProposal{
|
||||
proposal(0, "glossary", "Jesters", "Gestures"),
|
||||
},
|
||||
@@ -139,14 +137,15 @@ func TestNewGlossaryStageRejectsProtectedTermChange(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNewGlossaryStageAllowsProtectedTermInsertion(t *testing.T) {
|
||||
v, err := NewGlossaryStage()
|
||||
v, err := New()
|
||||
if err != nil {
|
||||
t.Fatalf("NewGlossaryStage: %v", err)
|
||||
t.Fatalf("New: %v", err)
|
||||
}
|
||||
|
||||
req := contracts.ValidationRequest{
|
||||
ModuleKey: "glossary",
|
||||
Glossary: tinyGlossary(),
|
||||
ModuleKey: "glossary",
|
||||
Glossary: tinyGlossary(),
|
||||
ProtectedTerms: glossary.Vocabulary(tinyGlossary(), nil),
|
||||
CandidateProposal: []proposals.EnrichedCorrectionProposal{
|
||||
proposal(0, "glossary", "gestures", "Jesters"),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user