mirror of
https://github.com/smmarty/friflex_flutter_starter.git
synced 2025-12-22 17:40: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}
|
/// {@endtemplate}
|
||||||
class _AppInternal extends StatefulWidget {
|
class _AppInternal extends StatefulWidget {
|
||||||
/// {@macro app_internal}
|
/// {@macro app_internal}
|
||||||
const _AppInternal({required this.diContainer});
|
const _AppInternal({
|
||||||
|
required this.diContainer,
|
||||||
|
@visibleForTesting this.mockRouter,
|
||||||
|
});
|
||||||
|
|
||||||
/// Роутер приложения для навигации
|
/// Роутер приложения для навигации
|
||||||
|
|
||||||
/// Контейнер зависимостей
|
/// Контейнер зависимостей
|
||||||
final DiContainer diContainer;
|
final DiContainer diContainer;
|
||||||
|
|
||||||
|
/// Роутер приложения для навигации для тестирования
|
||||||
|
final GoRouter? mockRouter;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<_AppInternal> createState() => _AppInternalState();
|
State<_AppInternal> createState() => _AppInternalState();
|
||||||
}
|
}
|
||||||
@@ -124,7 +130,9 @@ class _AppInternalState extends State<_AppInternal> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
router = AppRouter.createRouter(widget.diContainer.debugService);
|
router =
|
||||||
|
widget.mockRouter ??
|
||||||
|
AppRouter.createRouter(widget.diContainer.debugService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
Reference in New Issue
Block a user