Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make tests pass #32

Merged
merged 6 commits into from
Jan 31, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class ScaffoldWithNavigation extends StatelessWidget {
initialLocation: index == navigationShell.currentIndex,
);
}

@override
Widget build(BuildContext context) {
return SizedBox.expand(
Expand Down
28 changes: 18 additions & 10 deletions lib/ui/router/app_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,27 @@ final GoRouter router = GoRouter(
),
GoRoute(
path: '/forgot-password/confirm',
pageBuilder: (context, state) => platformPage(
ForgotPasswordConfirmPage(
data: state.extra as ForgotPasswordConfirmPageData,
),
fullscreenDialog: true,
),
pageBuilder: (context, state) {
final data = state.extra;
return platformPage(
data is ForgotPasswordConfirmPageData
? ForgotPasswordConfirmPage(data: data)
: const SizedBox(),
fullscreenDialog: true,
);
},
),
GoRoute(
path: '/change-password',
pageBuilder: (context, GoRouterState state) => platformPage(
ChangePasswordPage(data: state.extra as ChangePasswordPageData),
fullscreenDialog: true,
),
pageBuilder: (context, GoRouterState state) {
final data = state.extra;
return platformPage(
data is ChangePasswordPageData
? ChangePasswordPage(data: data)
: const SizedBox(),
fullscreenDialog: true,
);
},
),
GoRoute(
path: '/change-password/success',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ void main() {
'/change-password',
extra: const ChangePasswordPageData(token: 'token', uid: 'uid'),
);
await tester.pumpAndSettle();

when(() => getIt<IAuthRepository>().changePassword(any()))
.thenAnswer((_) async {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutter_base/ui/features/auth/views/change_password/change_passw
import 'package:flutter_base/ui/features/auth/views/forgot_password/forgot_password_confirm_page.dart';
import 'package:flutter_base/ui/i18n/locale_keys.g.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:go_router/go_router.dart';
import 'package:mocktail/mocktail.dart';

import '../../../../helpers/expects.dart';
Expand All @@ -19,6 +20,9 @@ void main() {
setUpAll(() {
configureMockDependencies();
});
setUp(() {
getIt<GoRouter>().go('/home');
});

group('Forgot Password Confirm Page Test', () {
testWidgets(
Expand All @@ -28,6 +32,7 @@ void main() {
'/forgot-password/confirm',
extra: ForgotPasswordConfirmPageData(email: fakeEmail),
);
await tester.pumpAndSettle();
expect(find.byType(ForgotPasswordConfirmPage), findsOneWidget);
final button = find.byKey(const Key('forgot-pass-confirm-button'));
expectButtonEnabled(tester, button, isEnabled: false);
Expand Down
Loading