1
0
Fork 0

fix: return an error instead of panic.

This commit is contained in:
Ludovic Fernandez 2019-09-30 17:52:04 +02:00 committed by Traefiker Bot
parent 86261f2b0a
commit 230cd28ac9
2 changed files with 59 additions and 15 deletions

View file

@ -538,3 +538,27 @@ func Test_decodeRawToNode(t *testing.T) {
})
}
}
func Test_decodeRawToNode_errors(t *testing.T) {
testCases := []struct {
desc string
data map[string]interface{}
}{
{
desc: "invalid type",
data: map[string]interface{}{
"foo": struct{}{},
},
},
}
for _, test := range testCases {
test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
_, err := decodeRawToNode(test.data, parser.DefaultRootName)
require.Error(t, err)
})
}
}