forked from eatvio/eatvio_app
refactor(tests): replace 'final' with 'const' for improved performance in various test files
This commit is contained in:
@@ -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<CommentsStateLoaded>());
|
||||
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,
|
||||
);
|
||||
|
||||
@@ -10,7 +10,7 @@ void main() {
|
||||
Widget createTestWidget(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: [
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
|
||||
@@ -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() {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class TestCubit extends BaseCubit<String> {
|
||||
|
||||
Future<String?> 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<String> {
|
||||
Future<String?> executeOperationWithState() async {
|
||||
return await safeExecuteWithState(
|
||||
() async {
|
||||
await Future.delayed(Duration(milliseconds: 10));
|
||||
await Future.delayed(const Duration(milliseconds: 10));
|
||||
return 'result';
|
||||
},
|
||||
loadingState: 'loading',
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -165,19 +165,19 @@ void main() {
|
||||
});
|
||||
|
||||
test('primaryColorScheme has primary color', () {
|
||||
final colorScheme = ColorSchemes.primaryColorScheme;
|
||||
const colorScheme = ColorSchemes.primaryColorScheme;
|
||||
|
||||
expect(colorScheme.primary, isA<Color>());
|
||||
});
|
||||
|
||||
test('primaryColorScheme has onPrimary color', () {
|
||||
final colorScheme = ColorSchemes.primaryColorScheme;
|
||||
const colorScheme = ColorSchemes.primaryColorScheme;
|
||||
|
||||
expect(colorScheme.onPrimary, isA<Color>());
|
||||
});
|
||||
|
||||
test('primaryColorScheme has onPrimaryContainer color', () {
|
||||
final colorScheme = ColorSchemes.primaryColorScheme;
|
||||
const colorScheme = ColorSchemes.primaryColorScheme;
|
||||
|
||||
expect(colorScheme.onPrimaryContainer, isA<Color>());
|
||||
});
|
||||
|
||||
@@ -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<Function>());
|
||||
|
||||
@@ -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(),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -73,7 +73,7 @@ void main() {
|
||||
text: 'Option 1',
|
||||
isSelected: false,
|
||||
onTap: () {},
|
||||
textStyle: TextStyle(fontSize: 20),
|
||||
textStyle: const TextStyle(fontSize: 20),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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(),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -15,7 +15,7 @@ void main() {
|
||||
}) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: [
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
|
||||
@@ -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(),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -12,7 +12,7 @@ void main() {
|
||||
home: Scaffold(
|
||||
body: Form(
|
||||
child: CustomDropDownButton<String>(
|
||||
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<String>(
|
||||
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<String>(
|
||||
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<String>(
|
||||
items: [
|
||||
items: const [
|
||||
DropdownMenuItem(value: 'option1', child: Text('Option 1')),
|
||||
DropdownMenuItem(value: 'option2', child: Text('Option 2')),
|
||||
],
|
||||
|
||||
@@ -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'),
|
||||
];
|
||||
|
||||
@@ -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: () {},
|
||||
),
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
|
||||
@@ -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<void> 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,
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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(),
|
||||
),
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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'),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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'),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
|
||||
@@ -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',
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -33,7 +33,7 @@ void main() {
|
||||
}) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: [
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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: ''),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -24,7 +24,7 @@ void main() {
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: BlocProvider<CreatePlanCubit>.value(
|
||||
value: mockCubit,
|
||||
child: Scaffold(
|
||||
child: const Scaffold(
|
||||
body: SelectExactOptionWidget(),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -25,7 +25,7 @@ void main() {
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: BlocProvider<CreateRecipeCubit>.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: [],
|
||||
|
||||
@@ -24,7 +24,7 @@ void main() {
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: BlocProvider<DiaryCubit>.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));
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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(),
|
||||
),
|
||||
|
||||
@@ -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: [
|
||||
|
||||
@@ -27,7 +27,7 @@ void main() {
|
||||
}) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: [
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
|
||||
@@ -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) {},
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -41,7 +41,7 @@ void main() {
|
||||
Widget createTestWidget(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: [
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
|
||||
@@ -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'),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -31,7 +31,7 @@ void main() {
|
||||
Widget createTestWidget(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: [
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
|
||||
@@ -41,7 +41,7 @@ void main() {
|
||||
Widget createTestWidget(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: [
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
|
||||
@@ -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),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -33,7 +33,7 @@ void main() {
|
||||
supportedLocales: const [Locale('ru')],
|
||||
home: BlocProvider<RegistrationCubitV2>.value(
|
||||
value: mockCubit,
|
||||
child: Scaffold(
|
||||
child: const Scaffold(
|
||||
body: SexWidget(),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -34,7 +34,7 @@ void main() {
|
||||
locale: const Locale('ru'),
|
||||
home: BlocProvider<RegistrationCubitV2>.value(
|
||||
value: mockCubit,
|
||||
child: Scaffold(
|
||||
child: const Scaffold(
|
||||
body: StepWidget(),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user