sum-types icon indicating copy to clipboard operation
sum-types copied to clipboard

Better Jest diffs for nullary sums

Open samhh opened this issue 1 year ago • 1 comments

Following #50 sums should be comparable with toEqual, however when an expectation fails the diff is a bit rubbish for nullary sums, stating "serializes to the same string".

I believe this is caused by the value (also) being a function rather than just an object.

We could define a custom matcher to fix this, or even override toEqual. How can we differentiate between a nullary sum and a non-nullary constructor? Do we need to?

samhh avatar Mar 23 '23 10:03 samhh