Write concise test for JSON decoders
Exercise a decoder over a list of input/expectation pairs.
For example
describeDecoder "int"
Json.Decode.int
[ ( "", FailsToDecode )
, ( "foo", FailsToDecode )
, ( "1", DecodesTo 1 )
, ( "1.5", FailsToDecode )
]Exercise a decoder with a JSON encoded string.
For example
testDecoder Json.Decode.string
"\"foo\""
(DecodesTo "foo")
Expectation for a decoder result.
FailsToDecode- expect the decoder to fail, the failure message can be anythingFailsToDecodeWith String- expect the decoder to fail with a specific messageDecodesTo a- expect the decoder to succeed, decoding to the provided value