Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Making test assertions on variant types

$
0
0

I was browsing the forums and saw another discussion on where someone with a similar issue created an “enum” function

let enum = ms =>
  switch ms {
  | Part1(_) => #Part1
  | Cancelled => #Cancelled
  | Part2(_) => #Part2
  | Part3(_) => #Part3
  }

This is probably the route I’ll choose, it’s minimal maintanance and the jest failures will also be able to differentiate got vs expected

enum(workflow)->expect->toBe(#Part2)

Viewing all articles
Browse latest Browse all 2592

Trending Articles