diff --git a/lib/typing/parse_test.go b/lib/typing/parse_test.go index a5bb1df7b..39674d924 100644 --- a/lib/typing/parse_test.go +++ b/lib/typing/parse_test.go @@ -1,7 +1,6 @@ package typing import ( - "errors" "fmt" "math" "testing" @@ -10,6 +9,21 @@ import ( ) func Test_ParseValue(t *testing.T) { + { + // Invalid + { + // Unknown data type + type Dusty struct{} + var dusty Dusty + _, err := ParseValue("dusty", nil, dusty) + assert.ErrorContains(t, err, "unknown type: typing.Dusty, value: {}") + } + { + // Another unknown data type + _, err := ParseValue("", nil, fmt.Errorf("hello there")) + assert.ErrorContains(t, err, "unknown type: *errors.errorString, value: hello there") + } + } { // Optional schema exists, so we are using it optionalSchema := map[string]KindDetails{"created_at": String} @@ -17,11 +31,6 @@ func Test_ParseValue(t *testing.T) { assert.Equal(t, String, MustParseValue("created_at", optionalSchema, val)) } } - { - // Invalid - assert.Equal(t, MustParseValue("", nil, nil), Invalid) - assert.Equal(t, MustParseValue("", nil, errors.New("hello")), Invalid) - } { // Nil assert.Equal(t, MustParseValue("", nil, ""), String)