Skip to content

Commit

Permalink
chore(#636): update routing in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Dec 20, 2023
1 parent 136fce8 commit bc28f2e
Show file tree
Hide file tree
Showing 12 changed files with 9 additions and 12 deletions.
11 changes: 4 additions & 7 deletions app/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,18 @@ are living in `common`. All such functions are exported from
The structure of an example module `lib/my_module` should look as follows:

- `my_module`
- `module.dart`:
- `module.dart` (see example below):
- exports everything that is required by other modules, i.e., page(s) and
possibly the cubit
- declares all routes as functions `myModuleRoute` (see example below)
- declares all routes as functions reeturning `AutoRoute`
- may contain initialization code (`initMyModule()`)
- `widgets`:
- `my_widget.dart`: contains `MyWidget` and helpers
- `pages`:
- `my_module.dart`: contains `MyModulePage` and helpers
- `my_child_page.dart`: contains
- `my_complex_page`: create a folder for complex pages (e.g., tabbed ones)
- `page.dart`: contains `MyComplexPage`
- `tab_first.dart`: contains `FirstTab` and helpers
- `tab_second.dart`: contains `SecondTab` and helpers
- `utils.dart`: contains utilities used by multiple files in this page
- `my_complex_page`: create a folder for complex pages (e.g., tabbed ones);
might want to create an own module if getting too complex
- `utils.dart`: contains utilities used throughout this module
- `cubit.dart`: contains `MyModuleCubit` and `MyModuleState`s (if needed)

Expand Down
2 changes: 1 addition & 1 deletion app/integration_test/faq_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void main() {
final faqWidget = MaterialApp.router(
routeInformationParser: appRouter.defaultRouteParser(),
routerDelegate: appRouter.delegate(
deepLinkBuilder: (_) => DeepLink.path('main/faq'),
deepLinkBuilder: (_) => DeepLink.path('/main/faq'),
),
localizationsDelegates: [
AppLocalizations.delegate,
Expand Down
2 changes: 1 addition & 1 deletion app/integration_test/main_page_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void main() {
child: MaterialApp.router(
routeInformationParser: appRouter.defaultRouteParser(),
routerDelegate: appRouter.delegate(
deepLinkBuilder: (_) => DeepLink.path('main'),
deepLinkBuilder: (_) => DeepLink.path('/main'),
),
localizationsDelegates: [
AppLocalizations.delegate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void main() {
debugShowCheckedModeBanner: false,
routeInformationParser: appRouter.defaultRouteParser(),
routerDelegate: appRouter.delegate(
deepLinkBuilder: (_) => DeepLink.path('main/settings'),
deepLinkBuilder: (_) => DeepLink.path('/main/more'),
),
localizationsDelegates: [
AppLocalizations.delegate,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/common/routing/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import '../../drug_selection/module.dart';
import '../../faq/module.dart';
import '../../login/module.dart';
import '../../main/module.dart';
import '../../more/module.dart';
import '../../onboarding/module.dart';
import '../../report/module.dart';
import '../../search/module.dart';
import '../../settings/module.dart';
import '../module.dart';

part 'router.gr.dart';
Expand Down
2 changes: 1 addition & 1 deletion app/lib/faq/module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import '../common/module.dart';
// For generated routes
export 'pages/faq.dart';

AutoRoute faqRoute() => AutoRoute(page: FaqRoute.page);
AutoRoute faqRoute() => AutoRoute(path: 'faq', page: FaqRoute.page);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit bc28f2e

Please sign in to comment.