mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-21 07:51:28 +02:00
fix: tests
This commit is contained in:
@@ -167,7 +167,17 @@ func TestConvertor(t *testing.T) {
|
||||
|
||||
t.Run("invalid", func(t *testing.T) {
|
||||
m := new(testModel)
|
||||
ExpectError(t, ErrUnsupportedConversion, MapUnmarshalValidate(map[string]any{"Test": struct{}{}}, m))
|
||||
err := MapUnmarshalValidate(map[string]any{"Test": struct{ a int }{1}}, m)
|
||||
ExpectError(t, ErrUnsupportedConversion, err)
|
||||
})
|
||||
|
||||
t.Run("set_empty", func(t *testing.T) {
|
||||
m := testModel{
|
||||
Test: testType{1, "2"},
|
||||
Baz: "3",
|
||||
}
|
||||
ExpectNoError(t, MapUnmarshalValidate(map[string]any{"Test": nil, "Baz": nil}, &m))
|
||||
ExpectEqual(t, m, testModel{})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user