-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
It may be useful for backward-compatibility or forward-compatibility to just test whether you can successfully decode JSON, without trying to test the matching encoding.
Example:
AesonSpec_Jest.test ("alarmState missing person: ") (fun () ->
let json = Js.Json.parseExn (Node.Fs.readFileAsUtf8Sync "alarm-golden/AlarmState_MissingPerson.json") in
let _ = Aeson.Decode.list (fun a -> Aeson.Decode.unwrapResult (OnpingFrontendTypes.decodeAlarmState a)) json
in AesonSpec_Jest.Ok
)This example assumes there is a list of inner decoders we really want to test. But it might be worth considering only making the function test the exact decoding shape and if you call it you can wrap i t in Aeson.Decode.list yourself. We could also provide a couple common decoding functions, one as a list and one as a sample (much like the current functions, but those aren't framed as a test).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels