Skip to content

Commit

Permalink
writing test for missing lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Dante291 committed Dec 24, 2023
1 parent 43af07d commit 90f7805
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ class _EditProfilePageState extends State<EditProfilePage> {
const Divider(),
// button to update the profile.
TextButton(
key: const Key('updatebtn'),
onPressed: () {
model.updateUserProfile(
firstName: model.firstNameTextController.text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ import '../../../helpers/test_locator.dart';

class MockBuildContext extends Mock implements BuildContext {}

class MockEditProfilePageViewModel extends Mock
implements EditProfilePageViewModel {}

class MockCallbackFunction extends Mock {
void call();
}
Expand Down Expand Up @@ -295,6 +298,32 @@ Future<void> main() async {
tester.tap(imageAvatar);
});
});
testWidgets("Testing Update butoon", (tester) async {
await mockNetworkImages(() async {
final mockctx = MockBuildContext();
userConfig.updateUser(User());
userConfig.updateUser(
User(firstName: 'Test', lastName: 'Test', email: '[email protected]'),
);
await tester.pumpWidget(createChangePassScreenDark());
await tester.pumpAndSettle();
final screenScaffoldWidget = find.byKey(
const Key('EditProfileScreenScaffold'),
);
expect(screenScaffoldWidget, findsOneWidget);
expect(
(tester.firstWidget(find.byKey(const Key('Root'))) as MaterialApp)
.theme!
.scaffoldBackgroundColor,
TalawaTheme.darkTheme.scaffoldBackgroundColor,
);
final updateButtonFinder = find.byKey(const Key('updatebtn'));
expect(updateButtonFinder, findsOneWidget);
await tester.tap(updateButtonFinder);
await tester.pumpAndSettle();
// verify(FocusScope.of(mockctx).unfocus()).called(1);
});
});
});
group('Testing image selection and removal in Edit Profile Screen', () {
setUp(() {
Expand Down

0 comments on commit 90f7805

Please sign in to comment.