Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/src/mock_navigator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,9 @@ class _MockNavigatorState extends NavigatorState {
arguments: arguments,
);
}

@override
void removeRouteBelow(Route<dynamic> anchorRoute) {
return _navigator.removeRouteBelow(anchorRoute);
Comment thread
alestiago marked this conversation as resolved.
}
}
16 changes: 16 additions & 0 deletions test/src/mock_navigator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -453,5 +453,21 @@ void main() {
),
).called(1);
});

testWidgets('mocks .removeRouteBelow calls', (tester) async {
when(() => navigator.removeRouteBelow(any())).thenAnswer((_) {});

await tester.pumpTest(
navigator: navigator,
builder: (context) => TextButton(
onPressed: () => Navigator.of(context).removeRouteBelow(testRoute),
child: const Text('Trigger'),
),
);

await tester.tap(find.byType(TextButton));

verify(() => navigator.removeRouteBelow(testRoute)).called(1);
});
});
}