Refactor validators into package-owned components
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package validators
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
@@ -31,7 +30,7 @@ func TestExtractProtectedTermsEmptyGlossary(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestProtectedGlossaryTermValidatorAppliesToNonGlossaryModule(t *testing.T) {
|
||||
func TestValidateProtectedTermsAppliesToNonGlossaryModule(t *testing.T) {
|
||||
req := Request{
|
||||
ModuleKey: "grammar",
|
||||
Glossary: &schema.Glossary{
|
||||
@@ -49,7 +48,7 @@ func TestProtectedGlossaryTermValidatorAppliesToNonGlossaryModule(t *testing.T)
|
||||
},
|
||||
},
|
||||
}
|
||||
res, err := (ProtectedGlossaryTermValidator{}).Validate(context.Background(), req)
|
||||
res, err := ValidateProtectedTerms(req, false)
|
||||
if err != nil {
|
||||
t.Fatalf("validator error: %v", err)
|
||||
}
|
||||
@@ -58,7 +57,7 @@ func TestProtectedGlossaryTermValidatorAppliesToNonGlossaryModule(t *testing.T)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGlossaryStageProtectedGlossaryTermValidatorAllowsProtectedTermSwap(t *testing.T) {
|
||||
func TestValidateProtectedTermsGlossaryStageAllowsProtectedTermSwap(t *testing.T) {
|
||||
req := Request{
|
||||
ModuleKey: "glossary",
|
||||
Glossary: &schema.Glossary{
|
||||
@@ -76,7 +75,7 @@ func TestGlossaryStageProtectedGlossaryTermValidatorAllowsProtectedTermSwap(t *t
|
||||
},
|
||||
},
|
||||
}
|
||||
res, err := (GlossaryStageProtectedGlossaryTermValidator{}).Validate(context.Background(), req)
|
||||
res, err := ValidateProtectedTerms(req, true)
|
||||
if err != nil {
|
||||
t.Fatalf("validator error: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user