From c57e683aa0765b97fdd96faaa8b8a629338e11a2 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Wed, 13 Mar 2024 11:20:27 +0300 Subject: [PATCH] test(registration): Favorite foods and birth date screen test passed --- .../favorite_foods_screen.dart | 2 +- test/date_of_birth_test.dart | 54 +++++++++++++++++++ test/favorite_foods_test.dart | 54 +++++++++++++++++++ 3 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 test/date_of_birth_test.dart create mode 100644 test/favorite_foods_test.dart diff --git a/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart b/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart index 4dc1ce6..8a576af 100644 --- a/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart +++ b/lib/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart @@ -38,7 +38,7 @@ class _FavoriteFoodsScreenState extends State { body: Container( width: double.maxFinite, padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), - child: Column(children: [ + child: ListView(children: [ SizedBox(height: 7.v), Container( height: 16.v, diff --git a/test/date_of_birth_test.dart b/test/date_of_birth_test.dart new file mode 100644 index 0000000..4d79b57 --- /dev/null +++ b/test/date_of_birth_test.dart @@ -0,0 +1,54 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart'; +import 'package:eatvio_app/presentation/registration/date_of_birth_screen/bloc/date_of_birth_bloc.dart'; +import 'package:eatvio_app/presentation/registration/date_of_birth_screen/models/date_of_birth_model.dart'; + +void main() { + group('AdditionalInfoScreen', () { + testWidgets('renders screen in initial state', (WidgetTester tester) async { + final myProfileBloc = DateOfBirthBloc(DateOfBirthState( + dateOfBirthModelObj: DateOfBirthModel( + userRegistrationSheet: UserRegistrationSheet( + name: "name", + firstName: "firstName", + lastName: "lastName", + email: "email", + password: "password", + passwordConfirmation: "passwordConfirmation", + termsAccepted: "termsAccepted", + birthdate: "birthdate", + gender: "gender", + country: "country", + city: "city", + lang: "lang", + weight: "weight", + height: "height", + chestCircumference: 'asdasd', + waistCircumference: "waistCircumference", + hipCircumference: "hipCircumference", + bloodPressureUp: "bloodPressureUp", + bloodPressureDown: "bloodPressureDown", + hasHypo: "hasHypo", + hasHyper: "hasHyper", + aboutAllergy: "aboutAllergy", + aboutTakingPils: "aboutTakingPils", + aboutSportHobbies: "aboutSportHobbies", + favoriteFoods: "favoriteFoods", + unfavoriteFoods: "unfavoriteFoods", + additionalInfo: + "additionalInfo")))); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: DateOfBirthScreen(), + ), + ), + ); + }); + }); +} diff --git a/test/favorite_foods_test.dart b/test/favorite_foods_test.dart new file mode 100644 index 0000000..2fbd838 --- /dev/null +++ b/test/favorite_foods_test.dart @@ -0,0 +1,54 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:eatvio_app/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart'; +import 'package:eatvio_app/presentation/registration/favorite_foods_screen/bloc/favorite_foods_bloc.dart'; +import 'package:eatvio_app/presentation/registration/favorite_foods_screen/models/favorite_foods_model.dart'; + +void main() { + group('AdditionalInfoScreen', () { + testWidgets('renders screen in initial state', (WidgetTester tester) async { + final myProfileBloc = FavoriteFoodsBloc(FavoriteFoodsState( + favoriteFoodsModelObj: FavoriteFoodsModel( + userRegistrationSheet: UserRegistrationSheet( + name: "name", + firstName: "firstName", + lastName: "lastName", + email: "email", + password: "password", + passwordConfirmation: "passwordConfirmation", + termsAccepted: "termsAccepted", + birthdate: "birthdate", + gender: "gender", + country: "country", + city: "city", + lang: "lang", + weight: "weight", + height: "height", + chestCircumference: 'asdasd', + waistCircumference: "waistCircumference", + hipCircumference: "hipCircumference", + bloodPressureUp: "bloodPressureUp", + bloodPressureDown: "bloodPressureDown", + hasHypo: "hasHypo", + hasHyper: "hasHyper", + aboutAllergy: "aboutAllergy", + aboutTakingPils: "aboutTakingPils", + aboutSportHobbies: "aboutSportHobbies", + favoriteFoods: "favoriteFoods", + unfavoriteFoods: "unfavoriteFoods", + additionalInfo: + "additionalInfo")))); // Ensure that MyProfileModel is non-nullable + + await tester.pumpWidget( + MaterialApp( + home: BlocProvider.value( + value: myProfileBloc, + child: FavoriteFoodsScreen(), + ), + ), + ); + }); + }); +}