sum-types
sum-types copied to clipboard
Better Jest diffs for nullary sums
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?