testing library

Testing helpers for apps that use go_router.

Classes

MockGoRouter
A stand-in GoRouter for widget tests that records every navigation call instead of building pages.
MockGoRouterProvider
Makes a MockGoRouter (or any GoRouter) available to child, so GoRouter.of(context) and the context.go style helpers find it.
One navigation call recorded by a MockGoRouter.

Enums

The kind of a NavigationCall.

Functions

currentLocation(GoRouter router) → Uri
The current location of router, for a real GoRouter or a MockGoRouter.
Opens link with openDeepLink and checks that router ends up at opens.
expectRedirect(WidgetTester tester, GoRouter router, {required String from, required String to}) → Future<void>
Opens from and checks that the router ends up at to.
expectRoute(GoRouter router, String location, {String? reason}) → void
Checks that router is showing location. Same as expect(router, isAt(location)).
isAt(String location) → Matcher
Matches a GoRouter that is showing location.
Delivers link to the app the way the operating system does when the user taps a deep link, then waits for navigation to settle.
pumpRouter(WidgetTester tester, GoRouter router) → Future<void>
Pumps a MaterialApp.router driven by router and waits for the first page to settle.