Skip to content

How to use absurd with E.fold #1622

Answered by samhh
adinvadim asked this question in Q&A
Discussion options

You must be logged in to vote

You can test the shape of the whole thing inside the constructor:

expect(data).toEqual(E.right({
  uid: 'uid',
  email: 'mail@mail.mail',
  role: 'user',
}))

Or use something like unsafeUnwrap, which is mildly more ergonomic than isRight; throwing an error is fine in the context of testing.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by adinvadim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants