felangel / equatable

A Dart package that helps to implement value based equality without needing to explicitly override == and hashCode.

Home Page:https://pub.dev/packages/equatable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EquatableConfig.stringify should be true in tests environment

orestesgaolin opened this issue · comments

Is your feature request related to a problem? Please describe.
Sometimes, when tests relying on equatable classes fail, it's hard to deduce what is the issue without knowing the values of the properties. For instance this can happen in bloc tests:

MyBloc emits [some_value] when something happens [E]
  Expected: [MyState:MyState]
    Actual: [MyState:MyState]
     Which: at location [0] is MyState:<MyState> instead of MyState:<MyState>

In the meantime, in debug mode, the global flag is set to true so it's easy to spot issue like that in the log.

Describe the solution you'd like
Equatable should have the EquatableConfig.stringify set to true in test environment.

Describe alternatives you've considered
Manually setting the flag for tests.

Additional context

This is done as part of v2.0.0 🎉