Does anyone have a preferred way to making assertions on a variant type? For example something like this:
type httpResponse<'a> =
| Success('a)
| Conflict(string)
| NotFound(string)
| UnAuthorized(string)
let response = await someTestApi()
// expect(response)->toBe(Success(_))
// expect(response)->toBe(NotFound(_))
So far, I’ve been manually pattern matching and throwing errors:
switch response {
| Success(_) => ()
| err => failwith("Expected 'success'")
}
But the output is unfavorable when a test fails and not easy to debug