We ran into some issues in our snapshot tests relying on Equatable types. As we needed to inject a const DateTime in a immutable struct, I stumbled upon this library, allowing me to properly test our data objects. We rely on the Equatable package to synthesise equality checks for these objects. Unfortunately, Equatable relies on runtimeType equality of all properties in the checks and was therefore failing the test assertion.
This example will print false even though the equality check implemented in ConstDateTime class prints true.
As it requires a bigger pull request on Equatable and some more in-depth thinking how derived types can allow equatability with parent types, I would suggest we merge this semi-hacky solution that allows our tests to pass. :)
Once again, hi! 👋 👻
We ran into some issues in our snapshot tests relying on
Equatable
types. As we needed to inject aconst DateTime
in a immutable struct, I stumbled upon this library, allowing me to properly test our data objects. We rely on theEquatable
package to synthesise equality checks for these objects. Unfortunately, Equatable relies on runtimeType equality of all properties in the checks and was therefore failing the test assertion.It's quite easy to reproduce:
This example will print
false
even though the equality check implemented inConstDateTime
class printstrue
.As it requires a bigger pull request on
Equatable
and some more in-depth thinking how derived types can allow equatability with parent types, I would suggest we merge this semi-hacky solution that allows our tests to pass. :)