|
4 | 4 |
|
5 | 5 | import 'package:firebase_auth/firebase_auth.dart' as fba;
|
6 | 6 | import 'package:firebase_ui_auth/firebase_ui_auth.dart';
|
| 7 | +import 'package:firebase_ui_shared/firebase_ui_shared.dart'; |
7 | 8 | import 'package:flutter/material.dart';
|
8 | 9 | import 'package:flutter_test/flutter_test.dart';
|
9 | 10 | import 'package:mockito/mockito.dart';
|
@@ -53,6 +54,10 @@ void main() {
|
53 | 54 | when(auth. sendPasswordResetEmail(email : '[email protected]')). thenAnswer(
|
54 | 55 | (_) => Future.value(),
|
55 | 56 | );
|
| 57 | + |
| 58 | + when(auth. sendPasswordResetEmail(email : '[email protected]')). thenAnswer( |
| 59 | + (_) => Future.delayed(const Duration(milliseconds: 200)), |
| 60 | + ); |
56 | 61 | });
|
57 | 62 |
|
58 | 63 | testWidgets('shows error if sendPasswordResetEmail failed', (tester) async {
|
@@ -81,5 +86,20 @@ void main() {
|
81 | 86 | expect(find.byType(ErrorText), findsNothing);
|
82 | 87 | },
|
83 | 88 | );
|
| 89 | + |
| 90 | + testWidgets("doesn't sendPasswordResetEmail on loading", (tester) async { |
| 91 | + await tester.pumpWidget(widget); |
| 92 | + |
| 93 | + final input = find.byType(TextField); |
| 94 | + await tester. enterText(input, '[email protected]'); |
| 95 | + |
| 96 | + final button = find.byType(LoadingButton); |
| 97 | + await tester.tap(button); |
| 98 | + await tester.tap(button); |
| 99 | + await tester.pumpAndSettle(); |
| 100 | + |
| 101 | + expect(find.byType(ErrorText), findsNothing); |
| 102 | + verify(auth. sendPasswordResetEmail(email : '[email protected]')). called( 1); |
| 103 | + }); |
84 | 104 | });
|
85 | 105 | }
|
0 commit comments