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