From 746d366c188fc6d2f8fcf19045be3ef9ba736094 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 8 Dec 2025 11:32:40 +0300 Subject: [PATCH] refactor(tests): replace 'final' with 'const' for improved performance in various test files --- .../comments_cubit/comments_state_test.dart | 12 ++-- .../comments_actions_bottom_sheet_test.dart | 2 +- test/core/constants/app_constants_test.dart | 13 ++-- test/core/cubit/base_cubit_test.dart | 4 +- test/core/cubit/state_utils_test.dart | 2 +- .../core/data/selection_popup_model_test.dart | 16 ++--- test/core/models/pagination_model_test.dart | 16 ++--- test/core/theme/theme_helper_test.dart | 6 +- test/core/utils/pagination_utils_test.dart | 2 +- test/core/widgets/add_item_button_test.dart | 4 +- .../widgets/animated_option_button_test.dart | 2 +- test/core/widgets/base_button_test.dart | 6 +- .../bottom_sheet_handler_bar_test.dart | 4 +- .../widgets/bottom_sheet_with_blur_test.dart | 18 ++--- test/core/widgets/cpfc_container_test.dart | 2 +- test/core/widgets/custom_divider_test.dart | 4 +- .../widgets/custom_drop_down_button_test.dart | 10 +-- test/core/widgets/custom_drop_down_test.dart | 2 +- .../widgets/custom_outlined_button_test.dart | 4 +- .../widgets/custom_text_form_field_test.dart | 16 ++--- test/core/widgets/data_error_widget_test.dart | 6 +- test/core/widgets/feed_icon_button_test.dart | 8 +-- test/core/widgets/info_row_test.dart | 8 +-- test/core/widgets/item_widget_test.dart | 6 +- test/core/widgets/loader_test.dart | 4 +- .../widgets/main_background_bouble_test.dart | 10 +-- .../widgets/marketing_bottom_sheet_test.dart | 8 +-- test/core/widgets/option_widget_test.dart | 68 +++---------------- test/core/widgets/show_error_dialog_test.dart | 16 ++--- ...cess_published_diet_bottom_sheet_test.dart | 10 +-- ...ss_published_recipe_bottom_sheet_test.dart | 8 +-- .../pages/blog_post_create_screen_test.dart | 4 +- .../cancel_plan_bottom_sheet_test.dart | 2 +- .../widgets/chat_entry_widget_test.dart | 14 ++-- .../widgets/error_widget_test.dart | 6 +- .../select_exact_option_widget_test.dart | 2 +- .../widgets/tags_widget_test.dart | 8 +-- .../add_product_button_widget_test.dart | 4 +- .../chosen_diet_widget_content_test.dart | 8 +-- .../widgets/comment_container_test.dart | 6 +- .../widgets/product_loader_widget_test.dart | 4 +- .../widgets/info_bouble_test.dart | 10 +-- .../widgets/more_options_test.dart | 2 +- .../presentation/widgets/chip_group_test.dart | 8 +-- .../widgets/choice_chip_widget_test.dart | 14 ++-- .../widgets/consultant_widget_test.dart | 12 ++-- .../duration_choice_filter_widget_test.dart | 2 +- .../widgets/filter_badge_test.dart | 12 ++-- .../sorting_drop_down_filter_test.dart | 2 +- .../type_choice_filter_widget_test.dart | 2 +- .../widgets/status_widget_test.dart | 6 +- .../pages/blood_pressure_screen_test.dart | 8 +-- .../pages/credentials_screen_test.dart | 8 +-- .../pages/date_of_birth_screen_test.dart | 8 +-- .../presentation/widgets/sex_widget_test.dart | 2 +- .../widgets/step_widget_test.dart | 2 +- 56 files changed, 199 insertions(+), 254 deletions(-) diff --git a/test/core/comments/comments_cubit/comments_state_test.dart b/test/core/comments/comments_cubit/comments_state_test.dart index 986e9da9..03fd5872 100644 --- a/test/core/comments/comments_cubit/comments_state_test.dart +++ b/test/core/comments/comments_cubit/comments_state_test.dart @@ -18,7 +18,7 @@ void main() { }); test('creates loaded state with comment', () { - final comment = CommentModel( + const comment = CommentModel( data: [], links: Links(first: '', last: '', prev: null, next: null), meta: Meta( @@ -33,14 +33,14 @@ void main() { ), ); - final state = CommentsState.loaded(comment: comment); + const state = CommentsState.loaded(comment: comment); expect(state, isA()); expect((state as CommentsStateLoaded).comment, comment); }); test('creates loaded state with replyId', () { - final comment = CommentModel( + const comment = CommentModel( data: [], links: Links(first: '', last: '', prev: null, next: null), meta: Meta( @@ -55,7 +55,7 @@ void main() { ), ); - final state = CommentsState.loaded( + const state = CommentsState.loaded( comment: comment, replyId: 123, ); @@ -64,7 +64,7 @@ void main() { }); test('creates loaded state with editedCommentId', () { - final comment = CommentModel( + const comment = CommentModel( data: [], links: Links(first: '', last: '', prev: null, next: null), meta: Meta( @@ -79,7 +79,7 @@ void main() { ), ); - final state = CommentsState.loaded( + const state = CommentsState.loaded( comment: comment, editedCommentId: 456, ); diff --git a/test/core/comments/presentation/comments_actions_bottom_sheet_test.dart b/test/core/comments/presentation/comments_actions_bottom_sheet_test.dart index c6a01f8e..a942f3b8 100644 --- a/test/core/comments/presentation/comments_actions_bottom_sheet_test.dart +++ b/test/core/comments/presentation/comments_actions_bottom_sheet_test.dart @@ -10,7 +10,7 @@ void main() { Widget createTestWidget(Widget child) { return MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, diff --git a/test/core/constants/app_constants_test.dart b/test/core/constants/app_constants_test.dart index b6a3ccd8..6284fcf8 100644 --- a/test/core/constants/app_constants_test.dart +++ b/test/core/constants/app_constants_test.dart @@ -31,17 +31,17 @@ void main() { group('Animations', () { test('has correct animation durations', () { - expect(AppConstants.defaultAnimationDuration, Duration(milliseconds: 300)); - expect(AppConstants.fastAnimationDuration, Duration(milliseconds: 150)); - expect(AppConstants.slowAnimationDuration, Duration(milliseconds: 500)); + expect(AppConstants.defaultAnimationDuration, const Duration(milliseconds: 300)); + expect(AppConstants.fastAnimationDuration, const Duration(milliseconds: 150)); + expect(AppConstants.slowAnimationDuration, const Duration(milliseconds: 500)); }); }); group('Timeouts', () { test('has correct timeout durations', () { - expect(AppConstants.defaultTimeout, Duration(seconds: 30)); - expect(AppConstants.shortTimeout, Duration(seconds: 10)); - expect(AppConstants.longTimeout, Duration(minutes: 2)); + expect(AppConstants.defaultTimeout, const Duration(seconds: 30)); + expect(AppConstants.shortTimeout, const Duration(seconds: 10)); + expect(AppConstants.longTimeout, const Duration(minutes: 2)); }); }); @@ -127,4 +127,3 @@ void main() { }); }); } - diff --git a/test/core/cubit/base_cubit_test.dart b/test/core/cubit/base_cubit_test.dart index bc95b6a9..20c82337 100644 --- a/test/core/cubit/base_cubit_test.dart +++ b/test/core/cubit/base_cubit_test.dart @@ -11,7 +11,7 @@ class TestCubit extends BaseCubit { Future executeOperation() async { return await safeExecute(() async { - await Future.delayed(Duration(milliseconds: 10)); + await Future.delayed(const Duration(milliseconds: 10)); return 'success'; }); } @@ -19,7 +19,7 @@ class TestCubit extends BaseCubit { Future executeOperationWithState() async { return await safeExecuteWithState( () async { - await Future.delayed(Duration(milliseconds: 10)); + await Future.delayed(const Duration(milliseconds: 10)); return 'result'; }, loadingState: 'loading', diff --git a/test/core/cubit/state_utils_test.dart b/test/core/cubit/state_utils_test.dart index ff974aec..4f31dbeb 100644 --- a/test/core/cubit/state_utils_test.dart +++ b/test/core/cubit/state_utils_test.dart @@ -49,7 +49,7 @@ void main() { }); test('getErrorMessage extracts error message from error state', () { - final errorState = 'error: Something went wrong'; + const errorState = 'error: Something went wrong'; final message = StateUtils.getErrorMessage(errorState); expect(message, isNotNull); expect(message, contains('Something')); diff --git a/test/core/data/selection_popup_model_test.dart b/test/core/data/selection_popup_model_test.dart index 3f5af0f9..50a1d396 100644 --- a/test/core/data/selection_popup_model_test.dart +++ b/test/core/data/selection_popup_model_test.dart @@ -4,7 +4,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { group('SelectionPopupModel', () { test('creates model with all parameters', () { - final model = SelectionPopupModel( + const model = SelectionPopupModel( id: 1, title: 'Test Title', value: 'Test Value', @@ -18,7 +18,7 @@ void main() { }); test('creates model with default isSelected value', () { - final model = SelectionPopupModel( + const model = SelectionPopupModel( title: 'Test Title', value: 'Test Value', ); @@ -27,7 +27,7 @@ void main() { }); test('creates model with null id', () { - final model = SelectionPopupModel( + const model = SelectionPopupModel( id: null, title: 'Test Title', value: 'Test Value', @@ -38,17 +38,17 @@ void main() { }); test('creates model with different value types', () { - final model1 = SelectionPopupModel( + const model1 = SelectionPopupModel( title: 'Test', value: 123, ); - final model2 = SelectionPopupModel( + const model2 = SelectionPopupModel( title: 'Test', value: 'String Value', ); - final model3 = SelectionPopupModel( + const model3 = SelectionPopupModel( title: 'Test', value: true, ); @@ -59,13 +59,13 @@ void main() { }); test('can be compared', () { - final model1 = SelectionPopupModel( + const model1 = SelectionPopupModel( id: 1, title: 'Test', value: 'Value', ); - final model2 = SelectionPopupModel( + const model2 = SelectionPopupModel( id: 1, title: 'Test', value: 'Value', diff --git a/test/core/models/pagination_model_test.dart b/test/core/models/pagination_model_test.dart index b80d9296..5a8e7602 100644 --- a/test/core/models/pagination_model_test.dart +++ b/test/core/models/pagination_model_test.dart @@ -4,7 +4,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { group('Links', () { test('creates Links with all parameters', () { - final links = Links( + const links = Links( first: 'http://example.com?page=1', last: 'http://example.com?page=10', prev: 'http://example.com?page=2', @@ -18,7 +18,7 @@ void main() { }); test('creates Links with null prev and next', () { - final links = Links( + const links = Links( first: 'http://example.com?page=1', last: 'http://example.com?page=10', prev: null, @@ -32,7 +32,7 @@ void main() { group('Link', () { test('creates Link with all parameters', () { - final link = Link( + const link = Link( url: 'http://example.com?page=1', label: '1', active: true, @@ -44,7 +44,7 @@ void main() { }); test('creates Link with null values', () { - final link = Link( + const link = Link( url: null, label: null, active: null, @@ -58,7 +58,7 @@ void main() { group('Meta', () { test('creates Meta with all parameters', () { - final meta = Meta( + const meta = Meta( currentPage: 1, from: 1, lastPage: 10, @@ -80,7 +80,7 @@ void main() { }); test('creates Meta with null optional values', () { - final meta = Meta( + const meta = Meta( currentPage: 1, from: null, lastPage: 10, @@ -99,12 +99,12 @@ void main() { }); test('creates Meta with links list', () { - final links = [ + const links = [ Link(url: 'http://example.com?page=1', label: '1', active: true), Link(url: 'http://example.com?page=2', label: '2', active: false), ]; - final meta = Meta( + const meta = Meta( currentPage: 1, from: 1, lastPage: 10, diff --git a/test/core/theme/theme_helper_test.dart b/test/core/theme/theme_helper_test.dart index 6deacfe7..01f2dcf8 100644 --- a/test/core/theme/theme_helper_test.dart +++ b/test/core/theme/theme_helper_test.dart @@ -165,19 +165,19 @@ void main() { }); test('primaryColorScheme has primary color', () { - final colorScheme = ColorSchemes.primaryColorScheme; + const colorScheme = ColorSchemes.primaryColorScheme; expect(colorScheme.primary, isA()); }); test('primaryColorScheme has onPrimary color', () { - final colorScheme = ColorSchemes.primaryColorScheme; + const colorScheme = ColorSchemes.primaryColorScheme; expect(colorScheme.onPrimary, isA()); }); test('primaryColorScheme has onPrimaryContainer color', () { - final colorScheme = ColorSchemes.primaryColorScheme; + const colorScheme = ColorSchemes.primaryColorScheme; expect(colorScheme.onPrimaryContainer, isA()); }); diff --git a/test/core/utils/pagination_utils_test.dart b/test/core/utils/pagination_utils_test.dart index 65f4d6eb..36cca6ac 100644 --- a/test/core/utils/pagination_utils_test.dart +++ b/test/core/utils/pagination_utils_test.dart @@ -30,7 +30,7 @@ void main() { ); // Scroll to trigger notification - await tester.drag(find.byType(SingleChildScrollView), Offset(0, -100)); + await tester.drag(find.byType(SingleChildScrollView), const Offset(0, -100)); await tester.pump(); expect(loadNewContent, isA()); diff --git a/test/core/widgets/add_item_button_test.dart b/test/core/widgets/add_item_button_test.dart index 1f0c447d..e18f1804 100644 --- a/test/core/widgets/add_item_button_test.dart +++ b/test/core/widgets/add_item_button_test.dart @@ -9,7 +9,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: AddItemButton(), ), ), @@ -44,7 +44,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: AddItemButton(), ), ), diff --git a/test/core/widgets/animated_option_button_test.dart b/test/core/widgets/animated_option_button_test.dart index 04151ad1..12294be7 100644 --- a/test/core/widgets/animated_option_button_test.dart +++ b/test/core/widgets/animated_option_button_test.dart @@ -73,7 +73,7 @@ void main() { text: 'Option 1', isSelected: false, onTap: () {}, - textStyle: TextStyle(fontSize: 20), + textStyle: const TextStyle(fontSize: 20), ), ), ), diff --git a/test/core/widgets/base_button_test.dart b/test/core/widgets/base_button_test.dart index 19fcc4e3..b4803774 100644 --- a/test/core/widgets/base_button_test.dart +++ b/test/core/widgets/base_button_test.dart @@ -27,12 +27,12 @@ void main() { body: BaseButton( text: 'Test Button', onPressed: () {}, - buttonStyle: ButtonStyle(), - buttonTextStyle: TextStyle(), + buttonStyle: const ButtonStyle(), + buttonTextStyle: const TextStyle(), isDisabled: false, height: 50.0, width: 100.0, - margin: EdgeInsets.all(10), + margin: const EdgeInsets.all(10), alignment: Alignment.center, ), ), diff --git a/test/core/widgets/bottom_sheet_handler_bar_test.dart b/test/core/widgets/bottom_sheet_handler_bar_test.dart index 6d0ba79f..823786f0 100644 --- a/test/core/widgets/bottom_sheet_handler_bar_test.dart +++ b/test/core/widgets/bottom_sheet_handler_bar_test.dart @@ -9,7 +9,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: BottomSheetHandlerBar(), ), ), @@ -23,7 +23,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: BottomSheetHandlerBar(), ), ), diff --git a/test/core/widgets/bottom_sheet_with_blur_test.dart b/test/core/widgets/bottom_sheet_with_blur_test.dart index 757937be..62be454b 100644 --- a/test/core/widgets/bottom_sheet_with_blur_test.dart +++ b/test/core/widgets/bottom_sheet_with_blur_test.dart @@ -16,10 +16,10 @@ void main() { onPressed: () { showBottomSheetWithBlur( context: context, - child: Text('Test Content'), + child: const Text('Test Content'), ); }, - child: Text('Show Bottom Sheet'), + child: const Text('Show Bottom Sheet'), ), ); }, @@ -44,11 +44,11 @@ void main() { onPressed: () { showBottomSheetWithBlur( context: context, - child: Text('Test Content'), + child: const Text('Test Content'), hasBlur: false, ); }, - child: Text('Show Bottom Sheet'), + child: const Text('Show Bottom Sheet'), ), ); }, @@ -73,11 +73,11 @@ void main() { onPressed: () { showBottomSheetWithBlur( context: context, - child: Text('Test Content'), + child: const Text('Test Content'), height: 300.0, ); }, - child: Text('Show Bottom Sheet'), + child: const Text('Show Bottom Sheet'), ), ); }, @@ -102,10 +102,10 @@ void main() { onPressed: () { showBottomSheetWithBlur( context: context, - child: Text('Test Content'), + child: const Text('Test Content'), ); }, - child: Text('Show Bottom Sheet'), + child: const Text('Show Bottom Sheet'), ), ); }, @@ -118,7 +118,7 @@ void main() { expect(find.text('Test Content'), findsOneWidget); - await tester.tapAt(Offset(0, 0)); + await tester.tapAt(const Offset(0, 0)); await tester.pumpAndSettle(); expect(find.text('Test Content'), findsNothing); diff --git a/test/core/widgets/cpfc_container_test.dart b/test/core/widgets/cpfc_container_test.dart index ec2da016..6fe4fe5d 100644 --- a/test/core/widgets/cpfc_container_test.dart +++ b/test/core/widgets/cpfc_container_test.dart @@ -15,7 +15,7 @@ void main() { }) { return MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, diff --git a/test/core/widgets/custom_divider_test.dart b/test/core/widgets/custom_divider_test.dart index 474815f6..b5082ec8 100644 --- a/test/core/widgets/custom_divider_test.dart +++ b/test/core/widgets/custom_divider_test.dart @@ -9,7 +9,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: CustomDivider(), ), ), @@ -23,7 +23,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: CustomDivider(), ), ), diff --git a/test/core/widgets/custom_drop_down_button_test.dart b/test/core/widgets/custom_drop_down_button_test.dart index b27d2560..e8943604 100644 --- a/test/core/widgets/custom_drop_down_button_test.dart +++ b/test/core/widgets/custom_drop_down_button_test.dart @@ -12,7 +12,7 @@ void main() { home: Scaffold( body: Form( child: CustomDropDownButton( - items: [ + items: const [ DropdownMenuItem(value: 'option1', child: Text('Option 1')), DropdownMenuItem(value: 'option2', child: Text('Option 2')), ], @@ -35,11 +35,11 @@ void main() { home: Scaffold( body: Form( child: CustomDropDownButton( - items: [ + items: const [ DropdownMenuItem(value: 'option1', child: Text('Option 1')), DropdownMenuItem(value: 'option2', child: Text('Option 2')), ], - hint: Text('Select option'), + hint: const Text('Select option'), onChanged: (value) {}, ), ), @@ -59,7 +59,7 @@ void main() { home: Scaffold( body: Form( child: CustomDropDownButton( - items: [ + items: const [ DropdownMenuItem(value: 'option1', child: Text('Option 1')), DropdownMenuItem(value: 'option2', child: Text('Option 2')), ], @@ -83,7 +83,7 @@ void main() { home: Scaffold( body: Form( child: CustomDropDownButton( - items: [ + items: const [ DropdownMenuItem(value: 'option1', child: Text('Option 1')), DropdownMenuItem(value: 'option2', child: Text('Option 2')), ], diff --git a/test/core/widgets/custom_drop_down_test.dart b/test/core/widgets/custom_drop_down_test.dart index b282078c..60f6d678 100644 --- a/test/core/widgets/custom_drop_down_test.dart +++ b/test/core/widgets/custom_drop_down_test.dart @@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { group('CustomDropDown', () { - final items = [ + const items = [ SelectionPopupModel(id: 1, title: 'Option 1'), SelectionPopupModel(id: 2, title: 'Option 2'), ]; diff --git a/test/core/widgets/custom_outlined_button_test.dart b/test/core/widgets/custom_outlined_button_test.dart index b7e57733..ee3f93ce 100644 --- a/test/core/widgets/custom_outlined_button_test.dart +++ b/test/core/widgets/custom_outlined_button_test.dart @@ -104,7 +104,7 @@ void main() { home: Scaffold( body: CustomOutlinedButton( text: 'Test Button', - leftIcon: Icon(Icons.add), + leftIcon: const Icon(Icons.add), buttonStyle: OutlinedButton.styleFrom(), onPressed: () {}, ), @@ -124,7 +124,7 @@ void main() { home: Scaffold( body: CustomOutlinedButton( text: 'Test Button', - rightIcon: Icon(Icons.arrow_forward), + rightIcon: const Icon(Icons.arrow_forward), buttonStyle: OutlinedButton.styleFrom(), onPressed: () {}, ), diff --git a/test/core/widgets/custom_text_form_field_test.dart b/test/core/widgets/custom_text_form_field_test.dart index aef6d848..09303a60 100644 --- a/test/core/widgets/custom_text_form_field_test.dart +++ b/test/core/widgets/custom_text_form_field_test.dart @@ -10,7 +10,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: CustomTextFormField(), ), ), @@ -24,7 +24,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: CustomTextFormField( hintText: 'Enter text', ), @@ -39,7 +39,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: CustomTextFormField( initialValue: 'Initial text', ), @@ -75,7 +75,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: CustomTextFormField( suffixText: 'kg', ), @@ -90,7 +90,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: CustomTextFormField( hasError: true, ), @@ -105,7 +105,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: CustomTextFormField( readOnly: true, initialValue: 'Read only text', @@ -121,7 +121,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: CustomTextFormField( keyboardType: TextInputType.number, ), @@ -151,7 +151,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: CustomTextFormField( maxLength: 10, ), diff --git a/test/core/widgets/data_error_widget_test.dart b/test/core/widgets/data_error_widget_test.dart index 443603c2..308972ca 100644 --- a/test/core/widgets/data_error_widget_test.dart +++ b/test/core/widgets/data_error_widget_test.dart @@ -15,7 +15,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -35,13 +35,13 @@ void main() { testWidgets('shows loader when reloading', (tester) async { Future onReload() async { - await Future.delayed(Duration(milliseconds: 100)); + await Future.delayed(const Duration(milliseconds: 100)); } await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, diff --git a/test/core/widgets/feed_icon_button_test.dart b/test/core/widgets/feed_icon_button_test.dart index 4e73ccf3..faedd30f 100644 --- a/test/core/widgets/feed_icon_button_test.dart +++ b/test/core/widgets/feed_icon_button_test.dart @@ -10,7 +10,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: FeedIconButton( icon: Icons.favorite, ), @@ -41,7 +41,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: FeedIconButton( text: 'Like', ), @@ -79,7 +79,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: FeedIconButton( icon: Icons.favorite, text: 'Like', @@ -97,7 +97,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: FeedIconButton( icon: Icons.favorite, ), diff --git a/test/core/widgets/info_row_test.dart b/test/core/widgets/info_row_test.dart index 6f4955ed..48a54976 100644 --- a/test/core/widgets/info_row_test.dart +++ b/test/core/widgets/info_row_test.dart @@ -11,7 +11,7 @@ void main() { Widget createTestWidget(Widget child) { return MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -27,7 +27,7 @@ void main() { testWidgets('displays info row widget', (tester) async { await tester.pumpWidget( createTestWidget( - InfoRow( + const InfoRow( type: ProductType.diet, ), ), @@ -39,7 +39,7 @@ void main() { testWidgets('displays info row for plan type', (tester) async { await tester.pumpWidget( createTestWidget( - InfoRow( + const InfoRow( type: ProductType.plan, ), ), @@ -51,7 +51,7 @@ void main() { testWidgets('displays info row for recipe type', (tester) async { await tester.pumpWidget( createTestWidget( - InfoRow( + const InfoRow( type: ProductType.recipe, ), ), diff --git a/test/core/widgets/item_widget_test.dart b/test/core/widgets/item_widget_test.dart index 5c091403..f68efc29 100644 --- a/test/core/widgets/item_widget_test.dart +++ b/test/core/widgets/item_widget_test.dart @@ -9,7 +9,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: ItemWidget(text: 'Test item'), ), ), @@ -23,7 +23,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: ItemWidget(text: 'Test item', reversed: true), ), ), @@ -37,7 +37,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: ItemWidget(text: 'Test item', iconSize: 30), ), ), diff --git a/test/core/widgets/loader_test.dart b/test/core/widgets/loader_test.dart index 76cc4663..e6b51461 100644 --- a/test/core/widgets/loader_test.dart +++ b/test/core/widgets/loader_test.dart @@ -6,7 +6,7 @@ void main() { group('Loader', () { testWidgets('displays loader widget', (tester) async { await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Scaffold( body: Loader(), ), @@ -19,7 +19,7 @@ void main() { testWidgets('has correct dimensions', (tester) async { await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Scaffold( body: Loader(), ), diff --git a/test/core/widgets/main_background_bouble_test.dart b/test/core/widgets/main_background_bouble_test.dart index cadcdf19..9c0b5296 100644 --- a/test/core/widgets/main_background_bouble_test.dart +++ b/test/core/widgets/main_background_bouble_test.dart @@ -9,7 +9,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: MainBackgroundBouble( child: Text('Test'), ), @@ -25,7 +25,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: MainBackgroundBouble( width: 200, child: Text('Test'), @@ -41,7 +41,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: MainBackgroundBouble( enableShadow: true, child: Text('Test'), @@ -57,7 +57,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: MainBackgroundBouble( hasError: true, child: Text('Test'), @@ -73,7 +73,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: MainBackgroundBouble( padding: EdgeInsets.all(16), child: Text('Test'), diff --git a/test/core/widgets/marketing_bottom_sheet_test.dart b/test/core/widgets/marketing_bottom_sheet_test.dart index 5908ad6e..656d5388 100644 --- a/test/core/widgets/marketing_bottom_sheet_test.dart +++ b/test/core/widgets/marketing_bottom_sheet_test.dart @@ -10,7 +10,7 @@ void main() { Widget createTestWidget(Widget child) { return MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -26,7 +26,7 @@ void main() { testWidgets('displays marketing bottom sheet', (tester) async { await tester.pumpWidget( createTestWidget( - MarketingBottomSheet(), + const MarketingBottomSheet(), ), ); @@ -37,7 +37,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -51,7 +51,7 @@ void main() { onPressed: () { showMarketingBottomSheet(context); }, - child: Text('Show'), + child: const Text('Show'), ), ); }, diff --git a/test/core/widgets/option_widget_test.dart b/test/core/widgets/option_widget_test.dart index 6876e89c..c38fb000 100644 --- a/test/core/widgets/option_widget_test.dart +++ b/test/core/widgets/option_widget_test.dart @@ -11,50 +11,28 @@ void main() { Widget createTestWidget(Widget child) { return MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], supportedLocales: S.delegate.supportedLocales, - home: Scaffold( - body: child, - ), + home: Scaffold(body: child), ); } testWidgets('returns SizedBox.shrink when option is null', (tester) async { - await tester.pumpWidget( - createTestWidget( - OptionWidget( - option: null, - duration: 7, - ), - ), - ); + await tester.pumpWidget(createTestWidget(const OptionWidget(option: null, duration: 7))); expect(find.byType(OptionWidget), findsOneWidget); expect(find.byType(SizedBox), findsWidgets); }); testWidgets('displays option widget with option', (tester) async { - final option = PacketOptions( - items: ['Item 1', 'Item 2'], - price: 1000.0, - short: 'Short', - description: 'Description', - hasPersonalDiet: false, - ); + const option = PacketOptions(items: ['Item 1', 'Item 2'], price: 1000.0, short: 'Short', description: 'Description', hasPersonalDiet: false); - await tester.pumpWidget( - createTestWidget( - OptionWidget( - option: option, - duration: 7, - ), - ), - ); + await tester.pumpWidget(createTestWidget(const OptionWidget(option: option, duration: 7))); expect(find.byType(OptionWidget), findsOneWidget); expect(find.text('Short'), findsOneWidget); @@ -62,47 +40,19 @@ void main() { }); testWidgets('displays option widget with personal diet', (tester) async { - final option = PacketOptions( - items: ['Item 1'], - price: 1000.0, - short: 'Short', - description: 'Description', - hasPersonalDiet: true, - ); + const option = PacketOptions(items: ['Item 1'], price: 1000.0, short: 'Short', description: 'Description', hasPersonalDiet: true); - await tester.pumpWidget( - createTestWidget( - OptionWidget( - option: option, - duration: 7, - ), - ), - ); + await tester.pumpWidget(createTestWidget(const OptionWidget(option: option, duration: 7))); expect(find.byType(OptionWidget), findsOneWidget); }); testWidgets('hides duration when disableDuration is true', (tester) async { - final option = PacketOptions( - items: ['Item 1'], - price: 1000.0, - short: 'Short', - description: 'Description', - hasPersonalDiet: false, - ); + const option = PacketOptions(items: ['Item 1'], price: 1000.0, short: 'Short', description: 'Description', hasPersonalDiet: false); - await tester.pumpWidget( - createTestWidget( - OptionWidget( - option: option, - duration: 7, - disableDuration: true, - ), - ), - ); + await tester.pumpWidget(createTestWidget(const OptionWidget(option: option, duration: 7, disableDuration: true))); expect(find.byType(OptionWidget), findsOneWidget); }); }); } - diff --git a/test/core/widgets/show_error_dialog_test.dart b/test/core/widgets/show_error_dialog_test.dart index a15e203e..d56c7fc0 100644 --- a/test/core/widgets/show_error_dialog_test.dart +++ b/test/core/widgets/show_error_dialog_test.dart @@ -9,7 +9,7 @@ void main() { testWidgets('displays error dialog with default title and description', (tester) async { await tester.pumpWidget( MaterialApp( - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -23,7 +23,7 @@ void main() { onPressed: () { showErrorDialog(context); }, - child: Text('Show Error'), + child: const Text('Show Error'), ), ); }, @@ -42,7 +42,7 @@ void main() { testWidgets('displays error dialog with custom title and description', (tester) async { await tester.pumpWidget( MaterialApp( - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -60,7 +60,7 @@ void main() { description: 'Custom Description', ); }, - child: Text('Show Error'), + child: const Text('Show Error'), ), ); }, @@ -78,7 +78,7 @@ void main() { testWidgets('displays error dialog with custom button title', (tester) async { await tester.pumpWidget( MaterialApp( - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -95,7 +95,7 @@ void main() { buttonTitle: 'Close', ); }, - child: Text('Show Error'), + child: const Text('Show Error'), ), ); }, @@ -112,7 +112,7 @@ void main() { testWidgets('closes dialog when button is tapped', (tester) async { await tester.pumpWidget( MaterialApp( - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -126,7 +126,7 @@ void main() { onPressed: () { showErrorDialog(context); }, - child: Text('Show Error'), + child: const Text('Show Error'), ), ); }, diff --git a/test/core/widgets/success_published_diet_bottom_sheet_test.dart b/test/core/widgets/success_published_diet_bottom_sheet_test.dart index f5a814a2..eda5dd38 100644 --- a/test/core/widgets/success_published_diet_bottom_sheet_test.dart +++ b/test/core/widgets/success_published_diet_bottom_sheet_test.dart @@ -10,7 +10,7 @@ void main() { Widget createTestWidget(Widget child) { return MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -26,7 +26,7 @@ void main() { testWidgets('displays success published diet bottom sheet', (tester) async { await tester.pumpWidget( createTestWidget( - SuccessPublishedDietOrPlanBottomSheet( + const SuccessPublishedDietOrPlanBottomSheet( title: 'Test Diet', ), ), @@ -39,7 +39,7 @@ void main() { testWidgets('displays diet published text when isPlan is false', (tester) async { await tester.pumpWidget( createTestWidget( - SuccessPublishedDietOrPlanBottomSheet( + const SuccessPublishedDietOrPlanBottomSheet( title: 'Test Diet', isPlan: false, ), @@ -52,7 +52,7 @@ void main() { testWidgets('displays plan published text when isPlan is true', (tester) async { await tester.pumpWidget( createTestWidget( - SuccessPublishedDietOrPlanBottomSheet( + const SuccessPublishedDietOrPlanBottomSheet( title: 'Test Plan', isPlan: true, ), @@ -65,7 +65,7 @@ void main() { testWidgets('displays plan title', (tester) async { await tester.pumpWidget( createTestWidget( - SuccessPublishedDietOrPlanBottomSheet( + const SuccessPublishedDietOrPlanBottomSheet( title: 'My Plan', isPlan: true, ), diff --git a/test/core/widgets/success_published_recipe_bottom_sheet_test.dart b/test/core/widgets/success_published_recipe_bottom_sheet_test.dart index 3607c789..70950a74 100644 --- a/test/core/widgets/success_published_recipe_bottom_sheet_test.dart +++ b/test/core/widgets/success_published_recipe_bottom_sheet_test.dart @@ -10,7 +10,7 @@ void main() { Widget createTestWidget(Widget child) { return MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -26,7 +26,7 @@ void main() { testWidgets('displays success published recipe bottom sheet', (tester) async { await tester.pumpWidget( createTestWidget( - SuccessPublishedRecipeBottomSheet( + const SuccessPublishedRecipeBottomSheet( title: 'Test Recipe', ), ), @@ -41,7 +41,7 @@ void main() { testWidgets('displays recipe title', (tester) async { await tester.pumpWidget( createTestWidget( - SuccessPublishedRecipeBottomSheet( + const SuccessPublishedRecipeBottomSheet( title: 'My Recipe', ), ), @@ -55,7 +55,7 @@ void main() { testWidgets('has ok button', (tester) async { await tester.pumpWidget( createTestWidget( - SuccessPublishedRecipeBottomSheet( + const SuccessPublishedRecipeBottomSheet( title: 'Test Recipe', ), ), diff --git a/test/features/blog_post_create/presentation/pages/blog_post_create_screen_test.dart b/test/features/blog_post_create/presentation/pages/blog_post_create_screen_test.dart index 4dbc87c0..a8416d3d 100644 --- a/test/features/blog_post_create/presentation/pages/blog_post_create_screen_test.dart +++ b/test/features/blog_post_create/presentation/pages/blog_post_create_screen_test.dart @@ -57,7 +57,7 @@ void main() { routes: [ GoRoute( path: '/home', - builder: (context, state) => Scaffold( + builder: (context, state) => const Scaffold( body: Center(child: Text('Home')), ), ), @@ -81,7 +81,7 @@ void main() { return MaterialApp.router( routerConfig: router, theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, diff --git a/test/features/cancel_plan_bottom_sheet/cancel_plan_bottom_sheet_test.dart b/test/features/cancel_plan_bottom_sheet/cancel_plan_bottom_sheet_test.dart index 1c09fa88..0449fbb6 100644 --- a/test/features/cancel_plan_bottom_sheet/cancel_plan_bottom_sheet_test.dart +++ b/test/features/cancel_plan_bottom_sheet/cancel_plan_bottom_sheet_test.dart @@ -33,7 +33,7 @@ void main() { }) { return MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, diff --git a/test/features/chat/presentation/widgets/chat_entry_widget_test.dart b/test/features/chat/presentation/widgets/chat_entry_widget_test.dart index 64028a58..cf12990a 100644 --- a/test/features/chat/presentation/widgets/chat_entry_widget_test.dart +++ b/test/features/chat/presentation/widgets/chat_entry_widget_test.dart @@ -16,7 +16,7 @@ void main() { Widget createTestWidget(ChatRoom chatRoom) { return MaterialApp.router( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -47,7 +47,7 @@ void main() { } testWidgets('displays chat room with user name', (tester) async { - final chatRoom = ChatRoom( + const chatRoom = ChatRoom( id: 'test-id', users: Users( fromChatUser: ChatUser( @@ -79,7 +79,7 @@ void main() { testWidgets('displays chat room with last message', (tester) async { final chatRoom = ChatRoom( id: 'test-id', - users: Users( + users: const Users( fromChatUser: ChatUser( id: 1, name: 'From User', @@ -116,7 +116,7 @@ void main() { }); testWidgets('displays chat room with unread messages count', (tester) async { - final chatRoom = ChatRoom( + const chatRoom = ChatRoom( id: 'test-id', users: Users( fromChatUser: ChatUser( @@ -148,7 +148,7 @@ void main() { testWidgets('displays message from current user', (tester) async { final chatRoom = ChatRoom( id: 'test-id', - users: Users( + users: const Users( fromChatUser: ChatUser( id: 1, name: 'From User', @@ -187,7 +187,7 @@ void main() { testWidgets('displays media attachment message', (tester) async { final chatRoom = ChatRoom( id: 'test-id', - users: Users( + users: const Users( fromChatUser: ChatUser( id: 1, name: 'From User', @@ -228,7 +228,7 @@ void main() { final chatRoom = ChatRoom( id: 'test-id', users: Users( - fromChatUser: ChatUser( + fromChatUser: const ChatUser( id: 1, name: 'From User', profilePhotoPath: null, diff --git a/test/features/create_diet/presentation/widgets/error_widget_test.dart b/test/features/create_diet/presentation/widgets/error_widget_test.dart index 199b54f7..ad2a7778 100644 --- a/test/features/create_diet/presentation/widgets/error_widget_test.dart +++ b/test/features/create_diet/presentation/widgets/error_widget_test.dart @@ -9,7 +9,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: ValidationErrorWidget(error: 'Test error message'), ), ), @@ -23,7 +23,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: ValidationErrorWidget(error: 'Test error'), ), ), @@ -51,7 +51,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: ValidationErrorWidget(error: ''), ), ), diff --git a/test/features/create_plan/presentation/widgets/select_exact_option_widget_test.dart b/test/features/create_plan/presentation/widgets/select_exact_option_widget_test.dart index 4e315712..206c5534 100644 --- a/test/features/create_plan/presentation/widgets/select_exact_option_widget_test.dart +++ b/test/features/create_plan/presentation/widgets/select_exact_option_widget_test.dart @@ -24,7 +24,7 @@ void main() { theme: ThemeHelper().themeData(), home: BlocProvider.value( value: mockCubit, - child: Scaffold( + child: const Scaffold( body: SelectExactOptionWidget(), ), ), diff --git a/test/features/create_recipe/presentation/widgets/tags_widget_test.dart b/test/features/create_recipe/presentation/widgets/tags_widget_test.dart index 1ebc5d5d..64d09c36 100644 --- a/test/features/create_recipe/presentation/widgets/tags_widget_test.dart +++ b/test/features/create_recipe/presentation/widgets/tags_widget_test.dart @@ -25,7 +25,7 @@ void main() { theme: ThemeHelper().themeData(), home: BlocProvider.value( value: mockCubit, - child: Scaffold( + child: const Scaffold( body: TagsWidget(), ), ), @@ -33,7 +33,7 @@ void main() { } testWidgets('displays tags widget', (tester) async { - final initialState = CreateRecipeState( + const initialState = CreateRecipeState( entity: RecipeCreateEntity( ingredients: [], steps: [], @@ -55,7 +55,7 @@ void main() { }); testWidgets('displays existing tags', (tester) async { - final stateWithTags = CreateRecipeState( + const stateWithTags = CreateRecipeState( entity: RecipeCreateEntity( ingredients: [], steps: [], @@ -78,7 +78,7 @@ void main() { }); testWidgets('calls addTag when add button is tapped', (tester) async { - final initialState = CreateRecipeState( + const initialState = CreateRecipeState( entity: RecipeCreateEntity( ingredients: [], steps: [], diff --git a/test/features/diary/presentation/widgets/add_product_button_widget_test.dart b/test/features/diary/presentation/widgets/add_product_button_widget_test.dart index c9c7bfb6..9f161f48 100644 --- a/test/features/diary/presentation/widgets/add_product_button_widget_test.dart +++ b/test/features/diary/presentation/widgets/add_product_button_widget_test.dart @@ -24,7 +24,7 @@ void main() { theme: ThemeHelper().themeData(), home: BlocProvider.value( value: mockCubit, - child: Scaffold( + child: const Scaffold( body: AddProductButtonWidget(), ), ), @@ -32,7 +32,7 @@ void main() { } testWidgets('displays add product button widget', (tester) async { - final loadingState = DiaryState.loading(); + const loadingState = DiaryState.loading(); when(mockCubit.state).thenReturn(loadingState); when(mockCubit.stream).thenAnswer((_) => Stream.value(loadingState)); diff --git a/test/features/diary/presentation/widgets/chosen_diet_widget_content_test.dart b/test/features/diary/presentation/widgets/chosen_diet_widget_content_test.dart index 7311898e..7aaafc73 100644 --- a/test/features/diary/presentation/widgets/chosen_diet_widget_content_test.dart +++ b/test/features/diary/presentation/widgets/chosen_diet_widget_content_test.dart @@ -10,7 +10,7 @@ void main() { Widget createTestWidget(Widget child) { return MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -26,7 +26,7 @@ void main() { testWidgets('displays chosen diet widget content', (tester) async { await tester.pumpWidget( createTestWidget( - ChosenDietWidgetContent( + const ChosenDietWidgetContent( currentDietDay: 5, dietName: 'Test Diet', dietDuration: 14, @@ -42,7 +42,7 @@ void main() { testWidgets('displays current day and duration', (tester) async { await tester.pumpWidget( createTestWidget( - ChosenDietWidgetContent( + const ChosenDietWidgetContent( currentDietDay: 7, dietName: 'Test Diet', dietDuration: 21, @@ -57,7 +57,7 @@ void main() { testWidgets('displays diet name with underline', (tester) async { await tester.pumpWidget( createTestWidget( - ChosenDietWidgetContent( + const ChosenDietWidgetContent( currentDietDay: 1, dietName: 'My Diet', dietDuration: 7, diff --git a/test/features/diary/presentation/widgets/comment_container_test.dart b/test/features/diary/presentation/widgets/comment_container_test.dart index 76da64fb..4b91b780 100644 --- a/test/features/diary/presentation/widgets/comment_container_test.dart +++ b/test/features/diary/presentation/widgets/comment_container_test.dart @@ -9,7 +9,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: CommentContainer(comment: 'Test comment'), ), ), @@ -23,7 +23,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: CommentContainer(comment: ''), ), ), @@ -37,7 +37,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: CommentContainer(comment: longComment), ), ), diff --git a/test/features/diary/presentation/widgets/product_loader_widget_test.dart b/test/features/diary/presentation/widgets/product_loader_widget_test.dart index 9ec53789..47be8102 100644 --- a/test/features/diary/presentation/widgets/product_loader_widget_test.dart +++ b/test/features/diary/presentation/widgets/product_loader_widget_test.dart @@ -7,7 +7,7 @@ void main() { group('ProductLoaderWidget', () { testWidgets('displays product loader widget', (tester) async { await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Scaffold( body: ProductLoaderWidget(), ), @@ -20,7 +20,7 @@ void main() { testWidgets('displays ListTile with activity indicator', (tester) async { await tester.pumpWidget( - MaterialApp( + const MaterialApp( home: Scaffold( body: ProductLoaderWidget(), ), diff --git a/test/features/diets/presentation/widgets/info_bouble_test.dart b/test/features/diets/presentation/widgets/info_bouble_test.dart index b326ef18..34cfc6cc 100644 --- a/test/features/diets/presentation/widgets/info_bouble_test.dart +++ b/test/features/diets/presentation/widgets/info_bouble_test.dart @@ -9,7 +9,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: InfoBouble( children: [ Text('Test'), @@ -29,7 +29,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: InfoBouble( backgroundColor: Colors.blue, children: [ @@ -47,7 +47,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: InfoBouble( radius: 20, children: [ @@ -65,7 +65,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: InfoBouble( padding: EdgeInsets.all(16), children: [ @@ -83,7 +83,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: InfoBouble( mainAxisAlignment: MainAxisAlignment.center, children: [ diff --git a/test/features/diets/presentation/widgets/more_options_test.dart b/test/features/diets/presentation/widgets/more_options_test.dart index 6b1c01da..8b3faaf6 100644 --- a/test/features/diets/presentation/widgets/more_options_test.dart +++ b/test/features/diets/presentation/widgets/more_options_test.dart @@ -27,7 +27,7 @@ void main() { }) { return MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, diff --git a/test/features/feed/presentation/widgets/chip_group_test.dart b/test/features/feed/presentation/widgets/chip_group_test.dart index 69aa5668..ef40a48f 100644 --- a/test/features/feed/presentation/widgets/chip_group_test.dart +++ b/test/features/feed/presentation/widgets/chip_group_test.dart @@ -12,7 +12,7 @@ void main() { home: Scaffold( body: ChipGroup( selectedChipIndex: 0, - chipsLabelList: ['All', 'Recipes', 'Diets'], + chipsLabelList: const ['All', 'Recipes', 'Diets'], setSelectedChipIndex: (index) {}, ), ), @@ -29,7 +29,7 @@ void main() { home: Scaffold( body: ChipGroup( selectedChipIndex: 0, - chipsLabelList: ['All', 'Recipes', 'Diets', 'Plans'], + chipsLabelList: const ['All', 'Recipes', 'Diets', 'Plans'], setSelectedChipIndex: (index) {}, ), ), @@ -51,7 +51,7 @@ void main() { home: Scaffold( body: ChipGroup( selectedChipIndex: 0, - chipsLabelList: ['All', 'Recipes', 'Diets'], + chipsLabelList: const ['All', 'Recipes', 'Diets'], setSelectedChipIndex: (index) { selectedIndex = index; }, @@ -73,7 +73,7 @@ void main() { home: Scaffold( body: ChipGroup( selectedChipIndex: 0, - chipsLabelList: [], + chipsLabelList: const [], setSelectedChipIndex: (index) {}, ), ), diff --git a/test/features/feed/presentation/widgets/choice_chip_widget_test.dart b/test/features/feed/presentation/widgets/choice_chip_widget_test.dart index 95bad3d0..2ebb647e 100644 --- a/test/features/feed/presentation/widgets/choice_chip_widget_test.dart +++ b/test/features/feed/presentation/widgets/choice_chip_widget_test.dart @@ -11,7 +11,7 @@ void main() { theme: ThemeHelper().themeData(), home: Scaffold( body: ChoiceChipWidget( - chipsLabelList: ['Option 1', 'Option 2'], + chipsLabelList: const ['Option 1', 'Option 2'], index: 0, selectedChipIndex: 0, onSelected: (selected) {}, @@ -30,7 +30,7 @@ void main() { theme: ThemeHelper().themeData(), home: Scaffold( body: ChoiceChipWidget( - chipsLabelList: ['Option 1', 'Option 2'], + chipsLabelList: const ['Option 1', 'Option 2'], index: 0, selectedChipIndex: 0, onSelected: (selected) {}, @@ -50,7 +50,7 @@ void main() { theme: ThemeHelper().themeData(), home: Scaffold( body: ChoiceChipWidget( - chipsLabelList: ['Option 1', 'Option 2'], + chipsLabelList: const ['Option 1', 'Option 2'], index: 1, selectedChipIndex: 0, onSelected: (selected) {}, @@ -70,10 +70,10 @@ void main() { theme: ThemeHelper().themeData(), home: Scaffold( body: ChoiceChipWidget( - chipsLabelList: ['Option 1'], + chipsLabelList: const ['Option 1'], index: 0, selectedChipIndex: 0, - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), onSelected: (selected) {}, ), ), @@ -89,7 +89,7 @@ void main() { theme: ThemeHelper().themeData(), home: Scaffold( body: ChoiceChipWidget( - chipsLabelList: ['Option 1'], + chipsLabelList: const ['Option 1'], index: 0, selectedChipIndex: 0, activeColor: Colors.blue, @@ -110,7 +110,7 @@ void main() { theme: ThemeHelper().themeData(), home: Scaffold( body: ChoiceChipWidget( - chipsLabelList: ['Option 1'], + chipsLabelList: const ['Option 1'], index: 0, selectedChipIndex: 0, onSelected: (selected) { diff --git a/test/features/feed/presentation/widgets/consultant_widget_test.dart b/test/features/feed/presentation/widgets/consultant_widget_test.dart index 6cd12128..8b84cafa 100644 --- a/test/features/feed/presentation/widgets/consultant_widget_test.dart +++ b/test/features/feed/presentation/widgets/consultant_widget_test.dart @@ -34,7 +34,7 @@ void main() { Widget createTestWidget(FeedConsultantModel consultant) { return MaterialApp.router( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -66,7 +66,7 @@ void main() { testWidgets('displays consultant information', (tester) async { await mockNetworkImagesFor(() async { - final consultant = FeedConsultantModel( + const consultant = FeedConsultantModel( slug: 'test-consultant', name: 'Test Consultant', photo: 'https://example.com/photo.jpg', @@ -87,7 +87,7 @@ void main() { testWidgets('displays consultant with badges', (tester) async { await mockNetworkImagesFor(() async { - final consultant = FeedConsultantModel( + const consultant = FeedConsultantModel( slug: 'test-consultant', name: 'Test Consultant', photo: 'https://example.com/photo.jpg', @@ -110,7 +110,7 @@ void main() { testWidgets('displays rating place', (tester) async { await mockNetworkImagesFor(() async { - final consultant = FeedConsultantModel( + const consultant = FeedConsultantModel( slug: 'test-consultant', name: 'Test Consultant', photo: 'https://example.com/photo.jpg', @@ -129,7 +129,7 @@ void main() { testWidgets('handles photo with https URL', (tester) async { await mockNetworkImagesFor(() async { - final consultant = FeedConsultantModel( + const consultant = FeedConsultantModel( slug: 'test-consultant', name: 'Test Consultant', photo: 'https://example.com/photo.jpg', @@ -148,7 +148,7 @@ void main() { testWidgets('handles photo without https URL', (tester) async { await mockNetworkImagesFor(() async { - final consultant = FeedConsultantModel( + const consultant = FeedConsultantModel( slug: 'test-consultant', name: 'Test Consultant', photo: '/storage/photo.jpg', diff --git a/test/features/feed/presentation/widgets/duration_choice_filter_widget_test.dart b/test/features/feed/presentation/widgets/duration_choice_filter_widget_test.dart index 911851d0..b4eb6fe9 100644 --- a/test/features/feed/presentation/widgets/duration_choice_filter_widget_test.dart +++ b/test/features/feed/presentation/widgets/duration_choice_filter_widget_test.dart @@ -41,7 +41,7 @@ void main() { Widget createTestWidget(Widget child) { return MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, diff --git a/test/features/feed/presentation/widgets/filter_badge_test.dart b/test/features/feed/presentation/widgets/filter_badge_test.dart index 50ce3b2d..522bf156 100644 --- a/test/features/feed/presentation/widgets/filter_badge_test.dart +++ b/test/features/feed/presentation/widgets/filter_badge_test.dart @@ -9,11 +9,9 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: FilterBadge( - filterBottomSheet: Container( - child: Text('Filter Bottom Sheet'), - ), + filterBottomSheet: Text('Filter Bottom Sheet'), ), ), ), @@ -27,11 +25,9 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: FilterBadge( - filterBottomSheet: Container( - child: Text('Filter Bottom Sheet'), - ), + filterBottomSheet: Text('Filter Bottom Sheet'), ), ), ), diff --git a/test/features/feed/presentation/widgets/sorting_drop_down_filter_test.dart b/test/features/feed/presentation/widgets/sorting_drop_down_filter_test.dart index 87128d59..60df9ad5 100644 --- a/test/features/feed/presentation/widgets/sorting_drop_down_filter_test.dart +++ b/test/features/feed/presentation/widgets/sorting_drop_down_filter_test.dart @@ -31,7 +31,7 @@ void main() { Widget createTestWidget(Widget child) { return MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, diff --git a/test/features/feed/presentation/widgets/type_choice_filter_widget_test.dart b/test/features/feed/presentation/widgets/type_choice_filter_widget_test.dart index 7956c1b1..bdae205a 100644 --- a/test/features/feed/presentation/widgets/type_choice_filter_widget_test.dart +++ b/test/features/feed/presentation/widgets/type_choice_filter_widget_test.dart @@ -41,7 +41,7 @@ void main() { Widget createTestWidget(Widget child) { return MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, diff --git a/test/features/finances_and_consultations_archive/presentation/widgets/status_widget_test.dart b/test/features/finances_and_consultations_archive/presentation/widgets/status_widget_test.dart index 2a594090..7a0cc861 100644 --- a/test/features/finances_and_consultations_archive/presentation/widgets/status_widget_test.dart +++ b/test/features/finances_and_consultations_archive/presentation/widgets/status_widget_test.dart @@ -9,7 +9,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: StatusWidget(status: Status.canceled), ), ), @@ -23,7 +23,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: StatusWidget(status: Status.success), ), ), @@ -37,7 +37,7 @@ void main() { await tester.pumpWidget( MaterialApp( theme: ThemeHelper().themeData(), - home: Scaffold( + home: const Scaffold( body: StatusWidget(status: Status.inProgress), ), ), diff --git a/test/features/registration/presentation/pages/blood_pressure_screen_test.dart b/test/features/registration/presentation/pages/blood_pressure_screen_test.dart index edc0d18e..8c97bbb1 100644 --- a/test/features/registration/presentation/pages/blood_pressure_screen_test.dart +++ b/test/features/registration/presentation/pages/blood_pressure_screen_test.dart @@ -36,7 +36,7 @@ void main() { Widget createTestWidget(UserRegistrationSheet sheet) { return MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -54,7 +54,7 @@ void main() { } testWidgets('displays blood pressure screen', (tester) async { - final sheet = UserRegistrationSheet( + const sheet = UserRegistrationSheet( firstName: 'Test', lastName: 'User', email: 'test@example.com', @@ -90,7 +90,7 @@ void main() { }); testWidgets('displays existing blood pressure values', (tester) async { - final sheet = UserRegistrationSheet( + const sheet = UserRegistrationSheet( firstName: 'Test', lastName: 'User', email: 'test@example.com', @@ -126,7 +126,7 @@ void main() { }); testWidgets('displays dropdowns for hypo and hyper', (tester) async { - final sheet = UserRegistrationSheet( + const sheet = UserRegistrationSheet( firstName: 'Test', lastName: 'User', email: 'test@example.com', diff --git a/test/features/registration/presentation/pages/credentials_screen_test.dart b/test/features/registration/presentation/pages/credentials_screen_test.dart index 10e06521..0908654b 100644 --- a/test/features/registration/presentation/pages/credentials_screen_test.dart +++ b/test/features/registration/presentation/pages/credentials_screen_test.dart @@ -36,7 +36,7 @@ void main() { Widget createTestWidget(UserRegistrationSheet sheet) { return MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -54,7 +54,7 @@ void main() { } testWidgets('displays email field', (tester) async { - final sheet = UserRegistrationSheet( + const sheet = UserRegistrationSheet( firstName: 'Test', lastName: 'User', email: '', @@ -90,7 +90,7 @@ void main() { }); testWidgets('displays password fields', (tester) async { - final sheet = UserRegistrationSheet( + const sheet = UserRegistrationSheet( firstName: 'Test', lastName: 'User', email: 'test@example.com', @@ -126,7 +126,7 @@ void main() { }); testWidgets('initializes with existing values', (tester) async { - final sheet = UserRegistrationSheet( + const sheet = UserRegistrationSheet( firstName: 'Test', lastName: 'User', email: 'test@example.com', diff --git a/test/features/registration/presentation/pages/date_of_birth_screen_test.dart b/test/features/registration/presentation/pages/date_of_birth_screen_test.dart index 5a6d086f..fd825ee9 100644 --- a/test/features/registration/presentation/pages/date_of_birth_screen_test.dart +++ b/test/features/registration/presentation/pages/date_of_birth_screen_test.dart @@ -36,7 +36,7 @@ void main() { Widget createTestWidget(UserRegistrationSheet sheet) { return MaterialApp( theme: ThemeHelper().themeData(), - localizationsDelegates: [ + localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -54,7 +54,7 @@ void main() { } testWidgets('displays date of birth screen', (tester) async { - final sheet = UserRegistrationSheet( + const sheet = UserRegistrationSheet( firstName: 'Test', lastName: 'User', email: 'test@example.com', @@ -90,7 +90,7 @@ void main() { }); testWidgets('displays existing birthdate when provided', (tester) async { - final sheet = UserRegistrationSheet( + const sheet = UserRegistrationSheet( firstName: 'Test', lastName: 'User', email: 'test@example.com', @@ -126,7 +126,7 @@ void main() { }); testWidgets('displays calendar icon', (tester) async { - final sheet = UserRegistrationSheet( + const sheet = UserRegistrationSheet( firstName: 'Test', lastName: 'User', email: 'test@example.com', diff --git a/test/features/registration_v2/presentation/widgets/sex_widget_test.dart b/test/features/registration_v2/presentation/widgets/sex_widget_test.dart index 2bcb957e..3e5fbae2 100644 --- a/test/features/registration_v2/presentation/widgets/sex_widget_test.dart +++ b/test/features/registration_v2/presentation/widgets/sex_widget_test.dart @@ -33,7 +33,7 @@ void main() { supportedLocales: const [Locale('ru')], home: BlocProvider.value( value: mockCubit, - child: Scaffold( + child: const Scaffold( body: SexWidget(), ), ), diff --git a/test/features/registration_v2/presentation/widgets/step_widget_test.dart b/test/features/registration_v2/presentation/widgets/step_widget_test.dart index efc51135..50279979 100644 --- a/test/features/registration_v2/presentation/widgets/step_widget_test.dart +++ b/test/features/registration_v2/presentation/widgets/step_widget_test.dart @@ -34,7 +34,7 @@ void main() { locale: const Locale('ru'), home: BlocProvider.value( value: mockCubit, - child: Scaffold( + child: const Scaffold( body: StepWidget(), ), ),