VeryGoodOpenSource / mockingjay

A package that makes it easy to mock, test, and verify navigation in Flutter. Created by Very Good Ventures 🦄

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to work with routes using private types.

tomwyr opened this issue · comments

It seems to be unable to mock navigator interactions when code in tests depends on types that are not publicly visible.

It's not uncommon that the Flutter SDK uses internal types that cannot be used outside the sdk. E.g. trying to test that DropdownButton pushes a dropdown menu will throw due to the when method generic type param that cannot be stubbed.

image

Attempting the above will fail with:

Exception has occurred.
TestFailure (No matching calls. All calls: MockNavigator.canPop(), MockNavigator.push<_DropdownRouteResult<String>>(_DropdownRoute<String>(RouteSettings(none, null), animation: null))

Mock navigator should expose a way of working around internal types (or maybe there already is one that I'm unaware of).