fix tests, minor changes in output

This commit is contained in:
Yann Hamon 2025-05-10 20:23:44 +02:00
parent feb7360d30
commit 872f8b00cc
2 changed files with 6 additions and 6 deletions

View file

@ -204,7 +204,7 @@ func (val *v) ValidateResource(res resource.Resource) Result {
} }
validationErrors = append(validationErrors, ValidationError{ validationErrors = append(validationErrors, ValidationError{
Path: path, Path: path,
Msg: ve.LocalizedError(message.NewPrinter(language.English)), Msg: ve.ErrorKind.LocalizedString(message.NewPrinter(language.English)),
}) })
} }

View file

@ -106,7 +106,7 @@ lastName: bar
[]ValidationError{ []ValidationError{
{ {
Path: "/firstName", Path: "/firstName",
Msg: "expected number, but got string", Msg: "got string, want number",
}, },
}, },
}, },
@ -145,7 +145,7 @@ firstName: foo
[]ValidationError{ []ValidationError{
{ {
Path: "", Path: "",
Msg: "missing properties: 'lastName'", Msg: "missing property 'lastName'",
}, },
}, },
}, },
@ -447,8 +447,8 @@ age: not a number
}`) }`)
expectedErrors := []ValidationError{ expectedErrors := []ValidationError{
{Path: "", Msg: "missing properties: 'lastName'"}, {Path: "", Msg: "missing property 'lastName'"},
{Path: "/age", Msg: "expected integer, but got string"}, {Path: "/age", Msg: "got string, want integer"},
} }
val := v{ val := v{
@ -523,7 +523,7 @@ firstName: foo
expectedStatuses := []Status{Valid, Invalid} expectedStatuses := []Status{Valid, Invalid}
expectedValidationErrors := []ValidationError{ expectedValidationErrors := []ValidationError{
{Path: "", Msg: "missing properties: 'lastName'"}, {Path: "", Msg: "missing property 'lastName'"},
} }
if !reflect.DeepEqual(expectedStatuses, gotStatuses) { if !reflect.DeepEqual(expectedStatuses, gotStatuses) {
t.Errorf("Expected %+v, got %+v", expectedStatuses, gotStatuses) t.Errorf("Expected %+v, got %+v", expectedStatuses, gotStatuses)