mirror of
https://github.com/smmarty/friflex_flutter_starter.git
synced 2025-12-22 09:30:45 +00:00
feat(app): add mockRouter to _AppInternal for improved testing
This commit is contained in:
@@ -106,13 +106,19 @@ class _AppState extends State<App> {
|
||||
/// {@endtemplate}
|
||||
class _AppInternal extends StatefulWidget {
|
||||
/// {@macro app_internal}
|
||||
const _AppInternal({required this.diContainer});
|
||||
const _AppInternal({
|
||||
required this.diContainer,
|
||||
@visibleForTesting this.mockRouter,
|
||||
});
|
||||
|
||||
/// Роутер приложения для навигации
|
||||
|
||||
/// Контейнер зависимостей
|
||||
final DiContainer diContainer;
|
||||
|
||||
/// Роутер приложения для навигации для тестирования
|
||||
final GoRouter? mockRouter;
|
||||
|
||||
@override
|
||||
State<_AppInternal> createState() => _AppInternalState();
|
||||
}
|
||||
@@ -124,7 +130,9 @@ class _AppInternalState extends State<_AppInternal> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
router = AppRouter.createRouter(widget.diContainer.debugService);
|
||||
router =
|
||||
widget.mockRouter ??
|
||||
AppRouter.createRouter(widget.diContainer.debugService);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user