forked from eatvio/eatvio_app
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
@@ -3,7 +3,7 @@ name: Eatvio App Android Test
|
||||
on: [ pull_request ]
|
||||
|
||||
env:
|
||||
flutter_version: "3.38.1"
|
||||
flutter_version: "3.38.5"
|
||||
java_version: "21.x"
|
||||
flutter_channel: "stable"
|
||||
my_local_cache_dir: "/opt/hostedtoolcache/"
|
||||
|
||||
@@ -1,29 +1,33 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'oauth_verification_confirm_response.freezed.dart';
|
||||
part 'oauth_verification_confirm_response.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class OAuthVerificationConfirmResponse with _$OAuthVerificationConfirmResponse {
|
||||
const factory OAuthVerificationConfirmResponse({
|
||||
required bool success,
|
||||
required String message,
|
||||
required String token,
|
||||
required Map<String, dynamic> user,
|
||||
@JsonKey(name: 'is_new_user') required bool isNewUser,
|
||||
}) = _OAuthVerificationConfirmResponse;
|
||||
|
||||
factory OAuthVerificationConfirmResponse.fromJson(Map<String, dynamic> json) => _$OAuthVerificationConfirmResponseFromJson(json);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'oauth_verification_confirm_response.freezed.dart';
|
||||
part 'oauth_verification_confirm_response.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class OAuthVerificationConfirmResponse with _$OAuthVerificationConfirmResponse {
|
||||
const factory OAuthVerificationConfirmResponse({
|
||||
required bool success,
|
||||
required String message,
|
||||
required String token,
|
||||
required Map<String, dynamic> user,
|
||||
@JsonKey(name: 'is_new_user') required bool isNewUser,
|
||||
}) = _OAuthVerificationConfirmResponse;
|
||||
|
||||
factory OAuthVerificationConfirmResponse.fromJson(Map<String, dynamic> json) => _$OAuthVerificationConfirmResponseFromJson(json);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,23 +1,27 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'oauth_verification_request_response.freezed.dart';
|
||||
part 'oauth_verification_request_response.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class OAuthVerificationRequestResponse with _$OAuthVerificationRequestResponse {
|
||||
const factory OAuthVerificationRequestResponse({required String email, required String status}) = _OAuthVerificationRequestResponse;
|
||||
|
||||
factory OAuthVerificationRequestResponse.fromJson(Map<String, dynamic> json) => _$OAuthVerificationRequestResponseFromJson(json);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'oauth_verification_request_response.freezed.dart';
|
||||
part 'oauth_verification_request_response.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class OAuthVerificationRequestResponse with _$OAuthVerificationRequestResponse {
|
||||
const factory OAuthVerificationRequestResponse({required String email, required String status}) = _OAuthVerificationRequestResponse;
|
||||
|
||||
factory OAuthVerificationRequestResponse.fromJson(Map<String, dynamic> json) => _$OAuthVerificationRequestResponseFromJson(json);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:eatvio_app/features/barcode/models/barcode_product_model.dart';
|
||||
import 'package:retrofit/retrofit.dart';
|
||||
|
||||
part 'barcode_service.g.dart';
|
||||
|
||||
@RestApi()
|
||||
abstract class BarcodeService {
|
||||
factory BarcodeService(Dio dio, {String baseUrl}) = _BarcodeService;
|
||||
|
||||
@GET('/api/gsone/barcode/{barcode}')
|
||||
Future<BarcodeProductModel> getProductByBarcode({@Path('barcode') required String barcode});
|
||||
|
||||
@GET('/api/gsone/barcode/status/{task_id}')
|
||||
Future<BarcodeTaskStatusModel> getTaskStatus({@Path('task_id') required String taskId});
|
||||
}
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:eatvio_app/features/barcode/models/barcode_product_model.dart';
|
||||
import 'package:retrofit/retrofit.dart';
|
||||
|
||||
part 'barcode_service.g.dart';
|
||||
|
||||
@RestApi()
|
||||
abstract class BarcodeService {
|
||||
factory BarcodeService(Dio dio, {String baseUrl}) = _BarcodeService;
|
||||
|
||||
@GET('/api/gsone/barcode/{barcode}')
|
||||
Future<BarcodeProductModel> getProductByBarcode({@Path('barcode') required String barcode});
|
||||
|
||||
@GET('/api/gsone/barcode/status/{task_id}')
|
||||
Future<BarcodeTaskStatusModel> getTaskStatus({@Path('task_id') required String taskId});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,176 +1,178 @@
|
||||
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/utils/date_time_utils.dart';
|
||||
import 'package:eatvio_app/core/widgets/custom_outlined_button.dart';
|
||||
import 'package:eatvio_app/core/widgets/custom_text_form_field.dart';
|
||||
import 'package:eatvio_app/features/create_diet/presentation/widgets/error_widget.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/cubit/registration_cubit.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/cubit/registration_state.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/presentation/widgets/sex_widget.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:mask_text_input_formatter/mask_text_input_formatter.dart';
|
||||
|
||||
class FirstStepContent extends StatefulWidget {
|
||||
const FirstStepContent({super.key});
|
||||
|
||||
@override
|
||||
State<FirstStepContent> createState() => _FirstStepContentState();
|
||||
}
|
||||
|
||||
class _FirstStepContentState extends State<FirstStepContent> {
|
||||
final maskFormatterForBirthday = MaskTextInputFormatter(mask: '##.##.####', filter: {"#": RegExp(r'[0-9]')}, type: MaskAutoCompletionType.lazy);
|
||||
|
||||
final firstNameController = TextEditingController();
|
||||
|
||||
final lastNameController = TextEditingController();
|
||||
|
||||
final emailController = TextEditingController();
|
||||
|
||||
final phoneController = TextEditingController();
|
||||
|
||||
final dateController = TextEditingController();
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
firstNameController.text = context.read<RegistrationCubitV2>().state.firstName;
|
||||
lastNameController.text = context.read<RegistrationCubitV2>().state.lastName;
|
||||
emailController.text = context.read<RegistrationCubitV2>().state.email;
|
||||
phoneController.text = context.read<RegistrationCubitV2>().state.phone;
|
||||
dateController.text = context.read<RegistrationCubitV2>().state.birthday?.format('dd.MM.yyyy') ?? '';
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return BlocBuilder<RegistrationCubitV2, RegistrationStateV2>(
|
||||
builder: (context, state) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.first_name, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
hintText: s.your_name,
|
||||
hasError: !state.isFirstNameValid,
|
||||
controller: firstNameController,
|
||||
onChanged: (val) {
|
||||
context.read<RegistrationCubitV2>().setFirstName(val);
|
||||
},
|
||||
),
|
||||
if (!state.isFirstNameValid) ...[const SizedBox(height: 4), ValidationErrorWidget(error: s.first_name_validation_error)],
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.last_name, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
hintText: s.your_last_name,
|
||||
hasError: !state.isLastNameValid,
|
||||
controller: lastNameController,
|
||||
onChanged: (val) {
|
||||
context.read<RegistrationCubitV2>().setLastName(val);
|
||||
},
|
||||
),
|
||||
if (!state.isLastNameValid) ...[const SizedBox(height: 4), ValidationErrorWidget(error: s.last_name_error)],
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(s.email, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
CustomTextFormField(
|
||||
hintText: s.type_email,
|
||||
hasError: !state.isEmailValid,
|
||||
controller: emailController,
|
||||
onChanged: (val) {
|
||||
context.read<RegistrationCubitV2>().setEmail(val);
|
||||
},
|
||||
),
|
||||
if (!state.isEmailValid) ...[
|
||||
const SizedBox(height: 4),
|
||||
ValidationErrorWidget(error: state.emailDisplayError.isEmpty ? s.email_error : state.emailDisplayError),
|
||||
],
|
||||
const SizedBox(height: 12),
|
||||
Text(s.phone, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
Column(
|
||||
children: [
|
||||
CustomTextFormField(
|
||||
hintText: '+7 (999) 999 99 99',
|
||||
controller: phoneController,
|
||||
hasError: !state.isPhoneValid,
|
||||
onChanged: (val) {
|
||||
context.read<RegistrationCubitV2>().setPhone(val);
|
||||
},
|
||||
),
|
||||
if (!state.isPhoneValid) ...[
|
||||
const SizedBox(height: 4),
|
||||
ValidationErrorWidget(error: state.phoneDisplayError.isEmpty ? s.phone_error : state.phoneDisplayError),
|
||||
],
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.date_of_birth, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
textInputAction: TextInputAction.done,
|
||||
hintText: '01.01.2000',
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [maskFormatterForBirthday],
|
||||
hasError: !state.isBirthdayValid,
|
||||
controller: dateController,
|
||||
onChanged: (val) {
|
||||
final dateArray = val.split('.');
|
||||
if (dateArray.length != 3) return;
|
||||
final date = DateTime(int.parse(dateArray[2]), int.parse(dateArray[1]), int.parse(dateArray[0]));
|
||||
context.read<RegistrationCubitV2>().setBirthday(date);
|
||||
},
|
||||
),
|
||||
if (!state.isBirthdayValid) ...[
|
||||
const SizedBox(height: 4),
|
||||
ValidationErrorWidget(error: state.dateOfBirthDisplayError.isEmpty ? s.date_of_birth_error : state.dateOfBirthDisplayError),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const Expanded(child: SexWidget()),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
CustomOutlinedButton(
|
||||
onPressed: () {
|
||||
context.read<RegistrationCubitV2>().nextStep();
|
||||
},
|
||||
text: s.next,
|
||||
height: 52,
|
||||
buttonTextStyle: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700),
|
||||
buttonStyle: ButtonStyle(side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400)),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/utils/date_time_utils.dart';
|
||||
import 'package:eatvio_app/core/widgets/custom_outlined_button.dart';
|
||||
import 'package:eatvio_app/core/widgets/custom_text_form_field.dart';
|
||||
import 'package:eatvio_app/features/create_diet/presentation/widgets/error_widget.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/cubit/registration_cubit.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/cubit/registration_state.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/presentation/widgets/sex_widget.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:mask_text_input_formatter/mask_text_input_formatter.dart';
|
||||
|
||||
class FirstStepContent extends StatefulWidget {
|
||||
const FirstStepContent({super.key});
|
||||
|
||||
@override
|
||||
State<FirstStepContent> createState() => _FirstStepContentState();
|
||||
}
|
||||
|
||||
class _FirstStepContentState extends State<FirstStepContent> {
|
||||
final maskFormatterForBirthday = MaskTextInputFormatter(mask: '##.##.####', filter: {"#": RegExp(r'[0-9]')}, type: MaskAutoCompletionType.lazy);
|
||||
|
||||
final firstNameController = TextEditingController();
|
||||
|
||||
final lastNameController = TextEditingController();
|
||||
|
||||
final emailController = TextEditingController();
|
||||
|
||||
final phoneController = TextEditingController();
|
||||
|
||||
final dateController = TextEditingController();
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
firstNameController.text = context.read<RegistrationCubitV2>().state.firstName;
|
||||
lastNameController.text = context.read<RegistrationCubitV2>().state.lastName;
|
||||
emailController.text = context.read<RegistrationCubitV2>().state.email;
|
||||
phoneController.text = context.read<RegistrationCubitV2>().state.phone;
|
||||
dateController.text = context.read<RegistrationCubitV2>().state.birthday?.format('dd.MM.yyyy') ?? '';
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return BlocBuilder<RegistrationCubitV2, RegistrationStateV2>(
|
||||
builder: (context, state) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.first_name, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
hintText: s.your_name,
|
||||
hasError: !state.isFirstNameValid,
|
||||
controller: firstNameController,
|
||||
onChanged: (val) {
|
||||
context.read<RegistrationCubitV2>().setFirstName(val);
|
||||
},
|
||||
),
|
||||
if (!state.isFirstNameValid) ...[const SizedBox(height: 4), ValidationErrorWidget(error: s.first_name_validation_error)],
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.last_name, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
hintText: s.your_last_name,
|
||||
hasError: !state.isLastNameValid,
|
||||
controller: lastNameController,
|
||||
onChanged: (val) {
|
||||
context.read<RegistrationCubitV2>().setLastName(val);
|
||||
},
|
||||
),
|
||||
if (!state.isLastNameValid) ...[const SizedBox(height: 4), ValidationErrorWidget(error: s.last_name_error)],
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(s.email, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
CustomTextFormField(
|
||||
hintText: s.type_email,
|
||||
hasError: !state.isEmailValid,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
controller: emailController,
|
||||
onChanged: (val) {
|
||||
context.read<RegistrationCubitV2>().setEmail(val);
|
||||
},
|
||||
),
|
||||
if (!state.isEmailValid) ...[
|
||||
const SizedBox(height: 4),
|
||||
ValidationErrorWidget(error: state.emailDisplayError.isEmpty ? s.email_error : state.emailDisplayError),
|
||||
],
|
||||
const SizedBox(height: 12),
|
||||
Text(s.phone, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
Column(
|
||||
children: [
|
||||
CustomTextFormField(
|
||||
hintText: '+7 (999) 999 99 99',
|
||||
controller: phoneController,
|
||||
hasError: !state.isPhoneValid,
|
||||
keyboardType: TextInputType.phone,
|
||||
onChanged: (val) {
|
||||
context.read<RegistrationCubitV2>().setPhone(val);
|
||||
},
|
||||
),
|
||||
if (!state.isPhoneValid) ...[
|
||||
const SizedBox(height: 4),
|
||||
ValidationErrorWidget(error: state.phoneDisplayError.isEmpty ? s.phone_error : state.phoneDisplayError),
|
||||
],
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.date_of_birth, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
textInputAction: TextInputAction.done,
|
||||
hintText: '01.01.2000',
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [maskFormatterForBirthday],
|
||||
hasError: !state.isBirthdayValid,
|
||||
controller: dateController,
|
||||
onChanged: (val) {
|
||||
final dateArray = val.split('.');
|
||||
if (dateArray.length != 3) return;
|
||||
final date = DateTime(int.parse(dateArray[2]), int.parse(dateArray[1]), int.parse(dateArray[0]));
|
||||
context.read<RegistrationCubitV2>().setBirthday(date);
|
||||
},
|
||||
),
|
||||
if (!state.isBirthdayValid) ...[
|
||||
const SizedBox(height: 4),
|
||||
ValidationErrorWidget(error: state.dateOfBirthDisplayError.isEmpty ? s.date_of_birth_error : state.dateOfBirthDisplayError),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const Expanded(child: SexWidget()),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
CustomOutlinedButton(
|
||||
onPressed: () {
|
||||
context.read<RegistrationCubitV2>().nextStep();
|
||||
},
|
||||
text: s.next,
|
||||
height: 52,
|
||||
buttonTextStyle: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700),
|
||||
buttonStyle: ButtonStyle(side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400)),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,12 @@ class _SecondStepContentState extends State<SecondStepContent> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
heightController.text = context.read<RegistrationCubitV2>().state.height.toString();
|
||||
weightController.text = context.read<RegistrationCubitV2>().state.weight.toString();
|
||||
heightController.text = context.read<RegistrationCubitV2>().state.height.toString() == '0'
|
||||
? ''
|
||||
: context.read<RegistrationCubitV2>().state.height.toString();
|
||||
weightController.text = context.read<RegistrationCubitV2>().state.weight.toString() == '0'
|
||||
? ''
|
||||
: context.read<RegistrationCubitV2>().state.weight.toString();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -61,6 +65,7 @@ class _SecondStepContentState extends State<SecondStepContent> {
|
||||
hintText: s.type_height,
|
||||
hasError: !state.isHeightValid,
|
||||
controller: heightController,
|
||||
keyboardType: TextInputType.number,
|
||||
textInputType: const TextInputType.numberWithOptions(),
|
||||
onChanged: (val) {
|
||||
final height = int.tryParse(val);
|
||||
@@ -84,6 +89,7 @@ class _SecondStepContentState extends State<SecondStepContent> {
|
||||
hintText: s.type_weight,
|
||||
hasError: !state.isWeightValid,
|
||||
controller: weightController,
|
||||
keyboardType: TextInputType.number,
|
||||
textInputType: const TextInputType.numberWithOptions(),
|
||||
onChanged: (val) {
|
||||
final weight = int.tryParse(val);
|
||||
|
||||
58
pubspec.yaml
58
pubspec.yaml
@@ -4,7 +4,7 @@ version: 1.3.10+90
|
||||
publish_to: 'none'
|
||||
|
||||
environment:
|
||||
sdk: '>=3.8.0 <4.0.0'
|
||||
sdk: ^3.10.4
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
@@ -15,7 +15,7 @@ dependencies:
|
||||
|
||||
flutter_bloc: ^9.1.1
|
||||
cached_network_image: ^3.4.1
|
||||
flutter_svg: ^2.2.0
|
||||
flutter_svg: ^2.2.3
|
||||
equatable: ^2.0.7
|
||||
freezed_annotation: ^3.1.0
|
||||
json_annotation: ^4.9.0
|
||||
@@ -23,12 +23,12 @@ dependencies:
|
||||
path_provider: ^2.1.5
|
||||
carousel_slider_plus: ^7.1.1
|
||||
flutter_form_builder: ^10.2.0
|
||||
image_picker: ^1.2.0
|
||||
image_picker: ^1.2.1
|
||||
flutter_typeahead: ^5.2.0
|
||||
go_router: ^17.0.0
|
||||
go_router: ^17.0.1
|
||||
keyboard_dismisser: ^3.0.0
|
||||
retrofit: ^4.7.1
|
||||
get_it: ^9.0.5
|
||||
retrofit: 4.7.2
|
||||
get_it: ^9.2.0
|
||||
dio: ^5.9.0
|
||||
dart_pusher_channels: ^1.2.3
|
||||
photo_view: ^0.15.0
|
||||
@@ -36,60 +36,60 @@ dependencies:
|
||||
url_launcher: ^6.3.2
|
||||
easy_debounce: ^2.0.3
|
||||
badges: ^3.1.2
|
||||
google_fonts: ^6.3.0
|
||||
syncfusion_flutter_charts: ^31.2.10
|
||||
syncfusion_flutter_gauges: ^31.2.10
|
||||
google_fonts: ^6.3.3
|
||||
syncfusion_flutter_charts: ^32.1.20
|
||||
syncfusion_flutter_gauges: ^32.1.20
|
||||
table_calendar: ^3.2.0
|
||||
flutter_keyboard_visibility: ^6.0.0
|
||||
share_plus: ^12.0.1
|
||||
flutter_html: ^3.0.0
|
||||
file_picker: ^10.3.1
|
||||
audioplayers: ^6.5.0
|
||||
file_picker: ^10.3.8
|
||||
audioplayers: ^6.5.1
|
||||
intl: ^0.20.2
|
||||
mask_text_input_formatter: ^2.9.0
|
||||
lottie: ^3.3.1
|
||||
lottie: ^3.3.2
|
||||
flutter_portal: ^1.1.4
|
||||
fluttertoast: ^9.0.0
|
||||
flutter_rating_bar: ^4.0.1
|
||||
flutter_image_compress: ^2.4.0
|
||||
image: ^4.5.4
|
||||
image: ^4.7.2
|
||||
dotted_border: ^3.1.0
|
||||
http: ^1.5.0
|
||||
flutter_native_splash: ^2.4.6
|
||||
http: ^1.6.0
|
||||
flutter_native_splash: ^2.4.7
|
||||
webview_flutter: ^4.13.0
|
||||
sentry_flutter: ^9.8.0
|
||||
sentry_flutter: ^9.9.1
|
||||
connectivity_plus: ^7.0.0
|
||||
visibility_detector: ^0.4.0+2
|
||||
firebase_core: ^4.0.0
|
||||
firebase_messaging: ^16.0.0
|
||||
firebase_core: ^4.3.0
|
||||
firebase_messaging: ^16.1.0
|
||||
http_parser: ^4.1.2
|
||||
path: ^1.9.1
|
||||
collection: ^1.19.1
|
||||
shared_preferences: ^2.5.3
|
||||
shared_preferences: ^2.5.4
|
||||
version: ^3.0.2
|
||||
package_info_plus: ^9.0.0
|
||||
device_info_plus: ^12.2.0
|
||||
device_info_plus: ^12.3.0
|
||||
permission_handler: ^12.0.1
|
||||
qr_code_scanner_plus: ^2.0.10+1
|
||||
qr_code_scanner_plus: ^2.0.14
|
||||
flutter_dotenv: ^6.0.0
|
||||
uuid: ^4.5.2
|
||||
appmetrica_plugin: ^3.3.0
|
||||
vk_id: ^1.0.3
|
||||
appmetrica_plugin: ^3.4.0
|
||||
vk_id: ^1.0.4
|
||||
flutter_login_yandex: ^0.0.5
|
||||
markdown: ^7.3.0
|
||||
flutter_password_generator: ^1.0.3
|
||||
mobile_scanner: ^7.1.3
|
||||
material_symbols_icons: ^4.2874.0
|
||||
mobile_scanner: ^7.1.4
|
||||
material_symbols_icons: ^4.2892.0
|
||||
rxdart: ^0.27.7
|
||||
gpassword: ^1.0.0
|
||||
webview_flutter_platform_interface: ^2.14.0
|
||||
|
||||
dev_dependencies:
|
||||
build_runner: ^2.7.0
|
||||
build_runner: ^2.10.4
|
||||
freezed: ^3.2.0
|
||||
json_serializable: ^6.10.0
|
||||
retrofit_generator: ^10.0.2
|
||||
mockito: ^5.5.0
|
||||
json_serializable: ^6.11.2
|
||||
retrofit_generator: 10.0.6
|
||||
mockito: ^5.6.1
|
||||
mocktail: ^1.0.4
|
||||
network_image_mock: ^2.1.1
|
||||
|
||||
|
||||
@@ -1,153 +1,157 @@
|
||||
import 'package:eatvio_app/core/constants/app_constants.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('AppConstants', () {
|
||||
group('Sizes', () {
|
||||
test('has correct padding values', () {
|
||||
expect(AppConstants.defaultPadding, 16.0);
|
||||
expect(AppConstants.smallPadding, 8.0);
|
||||
expect(AppConstants.largePadding, 24.0);
|
||||
expect(AppConstants.extraLargePadding, 32.0);
|
||||
});
|
||||
|
||||
test('has correct border radius values', () {
|
||||
expect(AppConstants.defaultBorderRadius, 8.0);
|
||||
expect(AppConstants.smallBorderRadius, 4.0);
|
||||
expect(AppConstants.largeBorderRadius, 16.0);
|
||||
});
|
||||
|
||||
test('has correct button height values', () {
|
||||
expect(AppConstants.defaultButtonHeight, 48.0);
|
||||
expect(AppConstants.smallButtonHeight, 36.0);
|
||||
expect(AppConstants.largeButtonHeight, 56.0);
|
||||
});
|
||||
|
||||
test('has correct content width values', () {
|
||||
expect(AppConstants.maxContentWidth, 400.0);
|
||||
expect(AppConstants.minContentWidth, 280.0);
|
||||
});
|
||||
});
|
||||
|
||||
group('Animations', () {
|
||||
test('has correct animation durations', () {
|
||||
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, const Duration(seconds: 30));
|
||||
expect(AppConstants.shortTimeout, const Duration(seconds: 10));
|
||||
expect(AppConstants.longTimeout, const Duration(minutes: 2));
|
||||
});
|
||||
});
|
||||
|
||||
group('Limits', () {
|
||||
test('has correct size limits', () {
|
||||
expect(AppConstants.maxImageSize, 5 * 1024 * 1024);
|
||||
expect(AppConstants.maxVideoSize, 100 * 1024 * 1024);
|
||||
});
|
||||
|
||||
test('has correct text length limits', () {
|
||||
expect(AppConstants.maxTextLength, 1000);
|
||||
expect(AppConstants.maxTitleLength, 100);
|
||||
expect(AppConstants.maxDescriptionLength, 500);
|
||||
});
|
||||
});
|
||||
|
||||
group('Pagination', () {
|
||||
test('has correct page sizes', () {
|
||||
expect(AppConstants.defaultPageSize, 20);
|
||||
expect(AppConstants.smallPageSize, 10);
|
||||
expect(AppConstants.largePageSize, 50);
|
||||
});
|
||||
});
|
||||
|
||||
group('Formats', () {
|
||||
test('has supported image formats', () {
|
||||
expect(AppConstants.supportedImageFormats, contains('jpg'));
|
||||
expect(AppConstants.supportedImageFormats, contains('jpeg'));
|
||||
expect(AppConstants.supportedImageFormats, contains('png'));
|
||||
expect(AppConstants.supportedImageFormats, contains('webp'));
|
||||
});
|
||||
|
||||
test('has supported video formats', () {
|
||||
expect(AppConstants.supportedVideoFormats, contains('mp4'));
|
||||
expect(AppConstants.supportedVideoFormats, contains('mov'));
|
||||
expect(AppConstants.supportedVideoFormats, contains('avi'));
|
||||
});
|
||||
});
|
||||
|
||||
group('Regex', () {
|
||||
test('has email regex', () {
|
||||
expect(AppConstants.emailRegex, isA<String>());
|
||||
expect(AppConstants.emailRegex.isNotEmpty, isTrue);
|
||||
});
|
||||
|
||||
test('has phone regex', () {
|
||||
expect(AppConstants.phoneRegex, isA<String>());
|
||||
expect(AppConstants.phoneRegex.isNotEmpty, isTrue);
|
||||
});
|
||||
|
||||
test('has URL regex', () {
|
||||
expect(AppConstants.urlRegex, isA<String>());
|
||||
expect(AppConstants.urlRegex.isNotEmpty, isTrue);
|
||||
});
|
||||
});
|
||||
|
||||
group('Messages', () {
|
||||
test('has error messages', () {
|
||||
expect(AppConstants.defaultErrorMessage, isA<String>());
|
||||
expect(AppConstants.networkErrorMessage, isA<String>());
|
||||
expect(AppConstants.timeoutErrorMessage, isA<String>());
|
||||
expect(AppConstants.unknownErrorMessage, isA<String>());
|
||||
});
|
||||
});
|
||||
|
||||
group('Keys', () {
|
||||
test('has SharedPreferences keys', () {
|
||||
expect(AppConstants.welcomeScreenShownKey, isA<String>());
|
||||
expect(AppConstants.userTokenKey, isA<String>());
|
||||
expect(AppConstants.userDataKey, isA<String>());
|
||||
expect(AppConstants.settingsKey, isA<String>());
|
||||
});
|
||||
});
|
||||
|
||||
group('API Endpoints', () {
|
||||
test('has API endpoints', () {
|
||||
expect(AppConstants.apiVersion, '/api');
|
||||
expect(AppConstants.authEndpoint, '/auth');
|
||||
expect(AppConstants.usersEndpoint, '/users');
|
||||
expect(AppConstants.postsEndpoint, '/posts');
|
||||
expect(AppConstants.commentsEndpoint, '/comments');
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/core/constants/app_constants.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('AppConstants', () {
|
||||
group('Sizes', () {
|
||||
test('has correct padding values', () {
|
||||
expect(AppConstants.defaultPadding, 16.0);
|
||||
expect(AppConstants.smallPadding, 8.0);
|
||||
expect(AppConstants.largePadding, 24.0);
|
||||
expect(AppConstants.extraLargePadding, 32.0);
|
||||
});
|
||||
|
||||
test('has correct border radius values', () {
|
||||
expect(AppConstants.defaultBorderRadius, 8.0);
|
||||
expect(AppConstants.smallBorderRadius, 4.0);
|
||||
expect(AppConstants.largeBorderRadius, 16.0);
|
||||
});
|
||||
|
||||
test('has correct button height values', () {
|
||||
expect(AppConstants.defaultButtonHeight, 48.0);
|
||||
expect(AppConstants.smallButtonHeight, 36.0);
|
||||
expect(AppConstants.largeButtonHeight, 56.0);
|
||||
});
|
||||
|
||||
test('has correct content width values', () {
|
||||
expect(AppConstants.maxContentWidth, 400.0);
|
||||
expect(AppConstants.minContentWidth, 280.0);
|
||||
});
|
||||
});
|
||||
|
||||
group('Animations', () {
|
||||
test('has correct animation durations', () {
|
||||
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, const Duration(seconds: 30));
|
||||
expect(AppConstants.shortTimeout, const Duration(seconds: 10));
|
||||
expect(AppConstants.longTimeout, const Duration(minutes: 2));
|
||||
});
|
||||
});
|
||||
|
||||
group('Limits', () {
|
||||
test('has correct size limits', () {
|
||||
expect(AppConstants.maxImageSize, 5 * 1024 * 1024);
|
||||
expect(AppConstants.maxVideoSize, 100 * 1024 * 1024);
|
||||
});
|
||||
|
||||
test('has correct text length limits', () {
|
||||
expect(AppConstants.maxTextLength, 1000);
|
||||
expect(AppConstants.maxTitleLength, 100);
|
||||
expect(AppConstants.maxDescriptionLength, 500);
|
||||
});
|
||||
});
|
||||
|
||||
group('Pagination', () {
|
||||
test('has correct page sizes', () {
|
||||
expect(AppConstants.defaultPageSize, 20);
|
||||
expect(AppConstants.smallPageSize, 10);
|
||||
expect(AppConstants.largePageSize, 50);
|
||||
});
|
||||
});
|
||||
|
||||
group('Formats', () {
|
||||
test('has supported image formats', () {
|
||||
expect(AppConstants.supportedImageFormats, contains('jpg'));
|
||||
expect(AppConstants.supportedImageFormats, contains('jpeg'));
|
||||
expect(AppConstants.supportedImageFormats, contains('png'));
|
||||
expect(AppConstants.supportedImageFormats, contains('webp'));
|
||||
});
|
||||
|
||||
test('has supported video formats', () {
|
||||
expect(AppConstants.supportedVideoFormats, contains('mp4'));
|
||||
expect(AppConstants.supportedVideoFormats, contains('mov'));
|
||||
expect(AppConstants.supportedVideoFormats, contains('avi'));
|
||||
});
|
||||
});
|
||||
|
||||
group('Regex', () {
|
||||
test('has email regex', () {
|
||||
expect(AppConstants.emailRegex, isA<String>());
|
||||
expect(AppConstants.emailRegex.isNotEmpty, isTrue);
|
||||
});
|
||||
|
||||
test('has phone regex', () {
|
||||
expect(AppConstants.phoneRegex, isA<String>());
|
||||
expect(AppConstants.phoneRegex.isNotEmpty, isTrue);
|
||||
});
|
||||
|
||||
test('has URL regex', () {
|
||||
expect(AppConstants.urlRegex, isA<String>());
|
||||
expect(AppConstants.urlRegex.isNotEmpty, isTrue);
|
||||
});
|
||||
});
|
||||
|
||||
group('Messages', () {
|
||||
test('has error messages', () {
|
||||
expect(AppConstants.defaultErrorMessage, isA<String>());
|
||||
expect(AppConstants.networkErrorMessage, isA<String>());
|
||||
expect(AppConstants.timeoutErrorMessage, isA<String>());
|
||||
expect(AppConstants.unknownErrorMessage, isA<String>());
|
||||
});
|
||||
});
|
||||
|
||||
group('Keys', () {
|
||||
test('has SharedPreferences keys', () {
|
||||
expect(AppConstants.welcomeScreenShownKey, isA<String>());
|
||||
expect(AppConstants.userTokenKey, isA<String>());
|
||||
expect(AppConstants.userDataKey, isA<String>());
|
||||
expect(AppConstants.settingsKey, isA<String>());
|
||||
});
|
||||
});
|
||||
|
||||
group('API Endpoints', () {
|
||||
test('has API endpoints', () {
|
||||
expect(AppConstants.apiVersion, '/api');
|
||||
expect(AppConstants.authEndpoint, '/auth');
|
||||
expect(AppConstants.usersEndpoint, '/users');
|
||||
expect(AppConstants.postsEndpoint, '/posts');
|
||||
expect(AppConstants.commentsEndpoint, '/comments');
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,88 +1,92 @@
|
||||
import 'package:eatvio_app/core/cubit/state_utils.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('StateUtils', () {
|
||||
test('isLoading returns true for loading state', () {
|
||||
expect(StateUtils.isLoading('loading'), isTrue);
|
||||
expect(StateUtils.isLoading('Loading'), isTrue);
|
||||
expect(StateUtils.isLoading('StateLoading'), isTrue);
|
||||
expect(StateUtils.isLoading('state_loading'), isTrue);
|
||||
});
|
||||
|
||||
test('isLoading returns false for non-loading state', () {
|
||||
expect(StateUtils.isLoading('loaded'), isFalse);
|
||||
expect(StateUtils.isLoading('error'), isFalse);
|
||||
expect(StateUtils.isLoading('success'), isFalse);
|
||||
});
|
||||
|
||||
test('isLoaded returns true for loaded state', () {
|
||||
expect(StateUtils.isLoaded('loaded'), isTrue);
|
||||
expect(StateUtils.isLoaded('Loaded'), isTrue);
|
||||
expect(StateUtils.isLoaded('StateLoaded'), isTrue);
|
||||
expect(StateUtils.isLoaded('state_loaded'), isTrue);
|
||||
});
|
||||
|
||||
test('isLoaded returns false for non-loaded state', () {
|
||||
expect(StateUtils.isLoaded('loading'), isFalse);
|
||||
expect(StateUtils.isLoaded('error'), isFalse);
|
||||
expect(StateUtils.isLoaded('initial'), isFalse);
|
||||
});
|
||||
|
||||
test('isError returns true for error state', () {
|
||||
expect(StateUtils.isError('error'), isTrue);
|
||||
expect(StateUtils.isError('Error'), isTrue);
|
||||
expect(StateUtils.isError('StateError'), isTrue);
|
||||
expect(StateUtils.isError('state_error'), isTrue);
|
||||
});
|
||||
|
||||
test('isError returns false for non-error state', () {
|
||||
expect(StateUtils.isError('loading'), isFalse);
|
||||
expect(StateUtils.isError('loaded'), isFalse);
|
||||
expect(StateUtils.isError('success'), isFalse);
|
||||
});
|
||||
|
||||
test('getErrorMessage returns null for non-error state', () {
|
||||
expect(StateUtils.getErrorMessage('loading'), isNull);
|
||||
expect(StateUtils.getErrorMessage('loaded'), isNull);
|
||||
expect(StateUtils.getErrorMessage('success'), isNull);
|
||||
});
|
||||
|
||||
test('getErrorMessage extracts error message from error state', () {
|
||||
const errorState = 'error: Something went wrong';
|
||||
final message = StateUtils.getErrorMessage(errorState);
|
||||
expect(message, isNotNull);
|
||||
expect(message, contains('Something'));
|
||||
});
|
||||
|
||||
test('getErrorMessage handles various error state formats', () {
|
||||
expect(StateUtils.getErrorMessage('error: test'), isNotNull);
|
||||
expect(StateUtils.getErrorMessage('Error: test message'), isNotNull);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/core/cubit/state_utils.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('StateUtils', () {
|
||||
test('isLoading returns true for loading state', () {
|
||||
expect(StateUtils.isLoading('loading'), isTrue);
|
||||
expect(StateUtils.isLoading('Loading'), isTrue);
|
||||
expect(StateUtils.isLoading('StateLoading'), isTrue);
|
||||
expect(StateUtils.isLoading('state_loading'), isTrue);
|
||||
});
|
||||
|
||||
test('isLoading returns false for non-loading state', () {
|
||||
expect(StateUtils.isLoading('loaded'), isFalse);
|
||||
expect(StateUtils.isLoading('error'), isFalse);
|
||||
expect(StateUtils.isLoading('success'), isFalse);
|
||||
});
|
||||
|
||||
test('isLoaded returns true for loaded state', () {
|
||||
expect(StateUtils.isLoaded('loaded'), isTrue);
|
||||
expect(StateUtils.isLoaded('Loaded'), isTrue);
|
||||
expect(StateUtils.isLoaded('StateLoaded'), isTrue);
|
||||
expect(StateUtils.isLoaded('state_loaded'), isTrue);
|
||||
});
|
||||
|
||||
test('isLoaded returns false for non-loaded state', () {
|
||||
expect(StateUtils.isLoaded('loading'), isFalse);
|
||||
expect(StateUtils.isLoaded('error'), isFalse);
|
||||
expect(StateUtils.isLoaded('initial'), isFalse);
|
||||
});
|
||||
|
||||
test('isError returns true for error state', () {
|
||||
expect(StateUtils.isError('error'), isTrue);
|
||||
expect(StateUtils.isError('Error'), isTrue);
|
||||
expect(StateUtils.isError('StateError'), isTrue);
|
||||
expect(StateUtils.isError('state_error'), isTrue);
|
||||
});
|
||||
|
||||
test('isError returns false for non-error state', () {
|
||||
expect(StateUtils.isError('loading'), isFalse);
|
||||
expect(StateUtils.isError('loaded'), isFalse);
|
||||
expect(StateUtils.isError('success'), isFalse);
|
||||
});
|
||||
|
||||
test('getErrorMessage returns null for non-error state', () {
|
||||
expect(StateUtils.getErrorMessage('loading'), isNull);
|
||||
expect(StateUtils.getErrorMessage('loaded'), isNull);
|
||||
expect(StateUtils.getErrorMessage('success'), isNull);
|
||||
});
|
||||
|
||||
test('getErrorMessage extracts error message from error state', () {
|
||||
const errorState = 'error: Something went wrong';
|
||||
final message = StateUtils.getErrorMessage(errorState);
|
||||
expect(message, isNotNull);
|
||||
expect(message, contains('Something'));
|
||||
});
|
||||
|
||||
test('getErrorMessage handles various error state formats', () {
|
||||
expect(StateUtils.getErrorMessage('error: test'), isNotNull);
|
||||
expect(StateUtils.getErrorMessage('Error: test message'), isNotNull);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,102 +1,106 @@
|
||||
import 'package:eatvio_app/core/data/selectionPopupModel/selection_popup_model.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('SelectionPopupModel', () {
|
||||
test('creates model with all parameters', () {
|
||||
const model = SelectionPopupModel(
|
||||
id: 1,
|
||||
title: 'Test Title',
|
||||
value: 'Test Value',
|
||||
isSelected: true,
|
||||
);
|
||||
|
||||
expect(model.id, 1);
|
||||
expect(model.title, 'Test Title');
|
||||
expect(model.value, 'Test Value');
|
||||
expect(model.isSelected, true);
|
||||
});
|
||||
|
||||
test('creates model with default isSelected value', () {
|
||||
const model = SelectionPopupModel(
|
||||
title: 'Test Title',
|
||||
value: 'Test Value',
|
||||
);
|
||||
|
||||
expect(model.isSelected, false);
|
||||
});
|
||||
|
||||
test('creates model with null id', () {
|
||||
const model = SelectionPopupModel(
|
||||
id: null,
|
||||
title: 'Test Title',
|
||||
value: 'Test Value',
|
||||
);
|
||||
|
||||
expect(model.id, null);
|
||||
expect(model.title, 'Test Title');
|
||||
});
|
||||
|
||||
test('creates model with different value types', () {
|
||||
const model1 = SelectionPopupModel(
|
||||
title: 'Test',
|
||||
value: 123,
|
||||
);
|
||||
|
||||
const model2 = SelectionPopupModel(
|
||||
title: 'Test',
|
||||
value: 'String Value',
|
||||
);
|
||||
|
||||
const model3 = SelectionPopupModel(
|
||||
title: 'Test',
|
||||
value: true,
|
||||
);
|
||||
|
||||
expect(model1.value, 123);
|
||||
expect(model2.value, 'String Value');
|
||||
expect(model3.value, true);
|
||||
});
|
||||
|
||||
test('can be compared', () {
|
||||
const model1 = SelectionPopupModel(
|
||||
id: 1,
|
||||
title: 'Test',
|
||||
value: 'Value',
|
||||
);
|
||||
|
||||
const model2 = SelectionPopupModel(
|
||||
id: 1,
|
||||
title: 'Test',
|
||||
value: 'Value',
|
||||
);
|
||||
|
||||
expect(model1 == model2, true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/core/data/selectionPopupModel/selection_popup_model.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('SelectionPopupModel', () {
|
||||
test('creates model with all parameters', () {
|
||||
const model = SelectionPopupModel(
|
||||
id: 1,
|
||||
title: 'Test Title',
|
||||
value: 'Test Value',
|
||||
isSelected: true,
|
||||
);
|
||||
|
||||
expect(model.id, 1);
|
||||
expect(model.title, 'Test Title');
|
||||
expect(model.value, 'Test Value');
|
||||
expect(model.isSelected, true);
|
||||
});
|
||||
|
||||
test('creates model with default isSelected value', () {
|
||||
const model = SelectionPopupModel(
|
||||
title: 'Test Title',
|
||||
value: 'Test Value',
|
||||
);
|
||||
|
||||
expect(model.isSelected, false);
|
||||
});
|
||||
|
||||
test('creates model with null id', () {
|
||||
const model = SelectionPopupModel(
|
||||
id: null,
|
||||
title: 'Test Title',
|
||||
value: 'Test Value',
|
||||
);
|
||||
|
||||
expect(model.id, null);
|
||||
expect(model.title, 'Test Title');
|
||||
});
|
||||
|
||||
test('creates model with different value types', () {
|
||||
const model1 = SelectionPopupModel(
|
||||
title: 'Test',
|
||||
value: 123,
|
||||
);
|
||||
|
||||
const model2 = SelectionPopupModel(
|
||||
title: 'Test',
|
||||
value: 'String Value',
|
||||
);
|
||||
|
||||
const model3 = SelectionPopupModel(
|
||||
title: 'Test',
|
||||
value: true,
|
||||
);
|
||||
|
||||
expect(model1.value, 123);
|
||||
expect(model2.value, 'String Value');
|
||||
expect(model3.value, true);
|
||||
});
|
||||
|
||||
test('can be compared', () {
|
||||
const model1 = SelectionPopupModel(
|
||||
id: 1,
|
||||
title: 'Test',
|
||||
value: 'Value',
|
||||
);
|
||||
|
||||
const model2 = SelectionPopupModel(
|
||||
id: 1,
|
||||
title: 'Test',
|
||||
value: 'Value',
|
||||
);
|
||||
|
||||
expect(model1 == model2, true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,51 +1,55 @@
|
||||
import 'package:eatvio_app/core/prefs_keys.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('PrefsKeys', () {
|
||||
test('has all expected values', () {
|
||||
expect(PrefsKeys.values.length, 4);
|
||||
expect(PrefsKeys.values, contains(PrefsKeys.hasAnonymousTokenBeenSent));
|
||||
expect(PrefsKeys.values, contains(PrefsKeys.welcomeScreenWasShowed));
|
||||
expect(PrefsKeys.values, contains(PrefsKeys.registrationDate));
|
||||
expect(PrefsKeys.values, contains(PrefsKeys.marketingBottomSheetHasBeenShown));
|
||||
});
|
||||
|
||||
test('can be compared', () {
|
||||
expect(PrefsKeys.hasAnonymousTokenBeenSent == PrefsKeys.hasAnonymousTokenBeenSent, true);
|
||||
expect(PrefsKeys.hasAnonymousTokenBeenSent == PrefsKeys.welcomeScreenWasShowed, false);
|
||||
});
|
||||
|
||||
test('has correct name property', () {
|
||||
expect(PrefsKeys.hasAnonymousTokenBeenSent.name, 'hasAnonymousTokenBeenSent');
|
||||
expect(PrefsKeys.welcomeScreenWasShowed.name, 'welcomeScreenWasShowed');
|
||||
expect(PrefsKeys.registrationDate.name, 'registrationDate');
|
||||
expect(PrefsKeys.marketingBottomSheetHasBeenShown.name, 'marketingBottomSheetHasBeenShown');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/core/prefs_keys.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('PrefsKeys', () {
|
||||
test('has all expected values', () {
|
||||
expect(PrefsKeys.values.length, 4);
|
||||
expect(PrefsKeys.values, contains(PrefsKeys.hasAnonymousTokenBeenSent));
|
||||
expect(PrefsKeys.values, contains(PrefsKeys.welcomeScreenWasShowed));
|
||||
expect(PrefsKeys.values, contains(PrefsKeys.registrationDate));
|
||||
expect(PrefsKeys.values, contains(PrefsKeys.marketingBottomSheetHasBeenShown));
|
||||
});
|
||||
|
||||
test('can be compared', () {
|
||||
expect(PrefsKeys.hasAnonymousTokenBeenSent == PrefsKeys.hasAnonymousTokenBeenSent, true);
|
||||
expect(PrefsKeys.hasAnonymousTokenBeenSent == PrefsKeys.welcomeScreenWasShowed, false);
|
||||
});
|
||||
|
||||
test('has correct name property', () {
|
||||
expect(PrefsKeys.hasAnonymousTokenBeenSent.name, 'hasAnonymousTokenBeenSent');
|
||||
expect(PrefsKeys.welcomeScreenWasShowed.name, 'welcomeScreenWasShowed');
|
||||
expect(PrefsKeys.registrationDate.name, 'registrationDate');
|
||||
expect(PrefsKeys.marketingBottomSheetHasBeenShown.name, 'marketingBottomSheetHasBeenShown');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,77 +1,81 @@
|
||||
import 'package:eatvio_app/core/internet_connection_cubit/internet_connection_state.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('InternetConnectionState', () {
|
||||
test('creates state with default isInternetAvailable value', () {
|
||||
final state = InternetConnectionState();
|
||||
|
||||
expect(state.isInternetAvailable, true);
|
||||
});
|
||||
|
||||
test('creates state with isInternetAvailable set to false', () {
|
||||
final state = InternetConnectionState(
|
||||
isInternetAvailable: false,
|
||||
);
|
||||
|
||||
expect(state.isInternetAvailable, false);
|
||||
});
|
||||
|
||||
test('creates state with isInternetAvailable set to true', () {
|
||||
final state = InternetConnectionState(
|
||||
isInternetAvailable: true,
|
||||
);
|
||||
|
||||
expect(state.isInternetAvailable, true);
|
||||
});
|
||||
|
||||
test('can be compared', () {
|
||||
final state1 = InternetConnectionState(
|
||||
isInternetAvailable: true,
|
||||
);
|
||||
|
||||
final state2 = InternetConnectionState(
|
||||
isInternetAvailable: true,
|
||||
);
|
||||
|
||||
expect(state1 == state2, true);
|
||||
});
|
||||
|
||||
test('different states are not equal', () {
|
||||
final state1 = InternetConnectionState(
|
||||
isInternetAvailable: true,
|
||||
);
|
||||
|
||||
final state2 = InternetConnectionState(
|
||||
isInternetAvailable: false,
|
||||
);
|
||||
|
||||
expect(state1 == state2, false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/core/internet_connection_cubit/internet_connection_state.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('InternetConnectionState', () {
|
||||
test('creates state with default isInternetAvailable value', () {
|
||||
final state = InternetConnectionState();
|
||||
|
||||
expect(state.isInternetAvailable, true);
|
||||
});
|
||||
|
||||
test('creates state with isInternetAvailable set to false', () {
|
||||
final state = InternetConnectionState(
|
||||
isInternetAvailable: false,
|
||||
);
|
||||
|
||||
expect(state.isInternetAvailable, false);
|
||||
});
|
||||
|
||||
test('creates state with isInternetAvailable set to true', () {
|
||||
final state = InternetConnectionState(
|
||||
isInternetAvailable: true,
|
||||
);
|
||||
|
||||
expect(state.isInternetAvailable, true);
|
||||
});
|
||||
|
||||
test('can be compared', () {
|
||||
final state1 = InternetConnectionState(
|
||||
isInternetAvailable: true,
|
||||
);
|
||||
|
||||
final state2 = InternetConnectionState(
|
||||
isInternetAvailable: true,
|
||||
);
|
||||
|
||||
expect(state1 == state2, true);
|
||||
});
|
||||
|
||||
test('different states are not equal', () {
|
||||
final state1 = InternetConnectionState(
|
||||
isInternetAvailable: true,
|
||||
);
|
||||
|
||||
final state2 = InternetConnectionState(
|
||||
isInternetAvailable: false,
|
||||
);
|
||||
|
||||
expect(state1 == state2, false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,47 +1,51 @@
|
||||
import 'package:eatvio_app/core/prefs_keys.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('PrefsKeys', () {
|
||||
test('все значения enum определены', () {
|
||||
expect(PrefsKeys.values.length, 4);
|
||||
expect(PrefsKeys.values, contains(PrefsKeys.hasAnonymousTokenBeenSent));
|
||||
expect(PrefsKeys.values, contains(PrefsKeys.welcomeScreenWasShowed));
|
||||
expect(PrefsKeys.values, contains(PrefsKeys.registrationDate));
|
||||
expect(PrefsKeys.values, contains(PrefsKeys.marketingBottomSheetHasBeenShown));
|
||||
});
|
||||
|
||||
test('имена ключей корректны', () {
|
||||
expect(PrefsKeys.hasAnonymousTokenBeenSent.name, 'hasAnonymousTokenBeenSent');
|
||||
expect(PrefsKeys.welcomeScreenWasShowed.name, 'welcomeScreenWasShowed');
|
||||
expect(PrefsKeys.registrationDate.name, 'registrationDate');
|
||||
expect(PrefsKeys.marketingBottomSheetHasBeenShown.name, 'marketingBottomSheetHasBeenShown');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/core/prefs_keys.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('PrefsKeys', () {
|
||||
test('все значения enum определены', () {
|
||||
expect(PrefsKeys.values.length, 4);
|
||||
expect(PrefsKeys.values, contains(PrefsKeys.hasAnonymousTokenBeenSent));
|
||||
expect(PrefsKeys.values, contains(PrefsKeys.welcomeScreenWasShowed));
|
||||
expect(PrefsKeys.values, contains(PrefsKeys.registrationDate));
|
||||
expect(PrefsKeys.values, contains(PrefsKeys.marketingBottomSheetHasBeenShown));
|
||||
});
|
||||
|
||||
test('имена ключей корректны', () {
|
||||
expect(PrefsKeys.hasAnonymousTokenBeenSent.name, 'hasAnonymousTokenBeenSent');
|
||||
expect(PrefsKeys.welcomeScreenWasShowed.name, 'welcomeScreenWasShowed');
|
||||
expect(PrefsKeys.registrationDate.name, 'registrationDate');
|
||||
expect(PrefsKeys.marketingBottomSheetHasBeenShown.name, 'marketingBottomSheetHasBeenShown');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,44 +1,48 @@
|
||||
import 'package:eatvio_app/core/routing/main_navigation_routes.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
void main() {
|
||||
group('MainNavigationRoutes', () {
|
||||
test('createRoutes возвращает список маршрутов', () {
|
||||
final routes = MainNavigationRoutes.createRoutes();
|
||||
expect(routes, isNotEmpty);
|
||||
expect(routes, isA<List<RouteBase>>());
|
||||
});
|
||||
|
||||
test('createRoutes содержит ShellRoute', () {
|
||||
final routes = MainNavigationRoutes.createRoutes();
|
||||
expect(routes.first, isA<ShellRoute>());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/core/routing/main_navigation_routes.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
void main() {
|
||||
group('MainNavigationRoutes', () {
|
||||
test('createRoutes возвращает список маршрутов', () {
|
||||
final routes = MainNavigationRoutes.createRoutes();
|
||||
expect(routes, isNotEmpty);
|
||||
expect(routes, isA<List<RouteBase>>());
|
||||
});
|
||||
|
||||
test('createRoutes содержит ShellRoute', () {
|
||||
final routes = MainNavigationRoutes.createRoutes();
|
||||
expect(routes.first, isA<ShellRoute>());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,127 +1,131 @@
|
||||
import 'package:eatvio_app/core/routing/route_constants.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('RouteConstants', () {
|
||||
test('has all auth routes defined', () {
|
||||
expect(RouteConstants.authScreen, '/auth-screen');
|
||||
expect(RouteConstants.registrationScreen, 'registration-screen');
|
||||
expect(RouteConstants.registrationScreenV2, 'registration-screen-v2');
|
||||
expect(RouteConstants.forgetPasswordScreen, 'forget-password-screen');
|
||||
expect(RouteConstants.scanQRCodeScreen, 'scan-qr-code-screen');
|
||||
expect(RouteConstants.verifyScreen, '/verify-screen');
|
||||
expect(RouteConstants.verifyEmailScreen, '/verify-email-screen');
|
||||
expect(RouteConstants.registerViaSocialScreen, '/register-via-social-screen');
|
||||
});
|
||||
|
||||
test('has all main navigation routes defined', () {
|
||||
expect(RouteConstants.myProfileScreen, '/my-profile-screen');
|
||||
expect(RouteConstants.feedScreen, '/feed-screen');
|
||||
expect(RouteConstants.diaryScreen, '/diary-screen');
|
||||
expect(RouteConstants.consultationsScreen, '/consultations-screen');
|
||||
expect(RouteConstants.chatSelectScreen, '/chat-select-screen');
|
||||
expect(RouteConstants.notificationsScreen, '/notifications-screen');
|
||||
expect(RouteConstants.menuScreen, '/menu-screen');
|
||||
});
|
||||
|
||||
test('has all content routes defined', () {
|
||||
expect(RouteConstants.aboutPlanScreen, '/about-plan-screen');
|
||||
expect(RouteConstants.aboutRecipesScreen, '/about-recipes-screen');
|
||||
expect(RouteConstants.aboutDietScreen, '/about-diet-screen');
|
||||
expect(RouteConstants.blogPostScreen, '/blog-post-screen');
|
||||
expect(RouteConstants.blogPostCreateScreen, '/blog-post-create-screen');
|
||||
});
|
||||
|
||||
test('has all profile routes defined', () {
|
||||
expect(RouteConstants.profileScreen, '/profile-screen');
|
||||
expect(RouteConstants.subsScreen, '/subs-screen');
|
||||
});
|
||||
|
||||
test('has all settings routes defined', () {
|
||||
expect(RouteConstants.settingsScreen, '/settings-screen');
|
||||
expect(RouteConstants.generalInfoScreen, 'general-info-screen');
|
||||
expect(RouteConstants.otherInfoScreen, 'other-info-screen');
|
||||
expect(RouteConstants.physicalActivityScreen, 'physical-activity-screen');
|
||||
expect(RouteConstants.physicalFormScreen, 'physical-form-screen');
|
||||
expect(RouteConstants.pressureScreen, 'pressure-screen');
|
||||
expect(RouteConstants.changePasswordScreen, 'change-password-screen');
|
||||
expect(RouteConstants.changeEmailScreen, 'change-email-screen');
|
||||
});
|
||||
|
||||
test('has all consultant routes defined', () {
|
||||
expect(RouteConstants.becomeConsultantScreen, '/become-consultant-screen');
|
||||
expect(RouteConstants.stepperBecomeConsultantScreen, '/stepper-become-consultant-screen');
|
||||
expect(RouteConstants.consultantRatingScreen, '/consultant-rating-screen');
|
||||
});
|
||||
|
||||
test('has all other routes defined', () {
|
||||
expect(RouteConstants.welcomeScreen, '/welcome-screen');
|
||||
expect(RouteConstants.updateScreen, '/update-screen');
|
||||
expect(RouteConstants.calendarScreen, '/calendar-screen');
|
||||
expect(RouteConstants.supportScreen, '/support-screen');
|
||||
expect(RouteConstants.photoViewScreen, '/photo-view-screen');
|
||||
expect(RouteConstants.chatScreen, '/chat-screen');
|
||||
expect(RouteConstants.emptyChatScreen, '/empty-chat-screen');
|
||||
expect(RouteConstants.glossaryScreen, '/glossary-screen');
|
||||
expect(RouteConstants.blockedUsersScreen, '/blocked-users-screen');
|
||||
expect(RouteConstants.notificationsSettingsScreen, '/notifications-settings-screen');
|
||||
});
|
||||
|
||||
test('has all finance routes defined', () {
|
||||
expect(RouteConstants.userFinanceScreen, '/user-finance-screen');
|
||||
expect(RouteConstants.cardSettingsScreen, '/card-settings-screen');
|
||||
expect(RouteConstants.orderInfoScreen, '/order-info-screen');
|
||||
expect(RouteConstants.paymentScreen, '/payment-screen');
|
||||
});
|
||||
|
||||
test('has all content creation routes defined', () {
|
||||
expect(RouteConstants.recipeCreateScreen, '/recipe-create-screen');
|
||||
expect(RouteConstants.createDietScreen, '/create-diet-screen');
|
||||
expect(RouteConstants.dietPreviewScreen, '/diet-preview-screen');
|
||||
expect(RouteConstants.createPlanScreen, '/create-plan-screen');
|
||||
expect(RouteConstants.myDietsScreen, '/my-diets-screen');
|
||||
expect(RouteConstants.myPlansScreen, '/my-plans-screen');
|
||||
expect(RouteConstants.myRecipesScreen, '/my-recipes-screen');
|
||||
});
|
||||
|
||||
test('has all user details routes defined', () {
|
||||
expect(RouteConstants.userDetailsScreen, '/user-details-screen');
|
||||
expect(RouteConstants.userDiaryScreen, '/user-diary-screen');
|
||||
});
|
||||
|
||||
test('has dev tools route defined', () {
|
||||
expect(RouteConstants.devToolsScreen, '/dev-tools-screen');
|
||||
});
|
||||
|
||||
test('has all archive routes defined', () {
|
||||
expect(RouteConstants.consultationsArchiveScreen, '/consultations-archive-screen');
|
||||
expect(RouteConstants.consultantFinancesScreen, '/consultant-finances-screen');
|
||||
expect(RouteConstants.userPurchasesScreen, '/user-purchases-screen');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/core/routing/route_constants.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('RouteConstants', () {
|
||||
test('has all auth routes defined', () {
|
||||
expect(RouteConstants.authScreen, '/auth-screen');
|
||||
expect(RouteConstants.registrationScreen, 'registration-screen');
|
||||
expect(RouteConstants.registrationScreenV2, 'registration-screen-v2');
|
||||
expect(RouteConstants.forgetPasswordScreen, 'forget-password-screen');
|
||||
expect(RouteConstants.scanQRCodeScreen, 'scan-qr-code-screen');
|
||||
expect(RouteConstants.verifyScreen, '/verify-screen');
|
||||
expect(RouteConstants.verifyEmailScreen, '/verify-email-screen');
|
||||
expect(RouteConstants.registerViaSocialScreen, '/register-via-social-screen');
|
||||
});
|
||||
|
||||
test('has all main navigation routes defined', () {
|
||||
expect(RouteConstants.myProfileScreen, '/my-profile-screen');
|
||||
expect(RouteConstants.feedScreen, '/feed-screen');
|
||||
expect(RouteConstants.diaryScreen, '/diary-screen');
|
||||
expect(RouteConstants.consultationsScreen, '/consultations-screen');
|
||||
expect(RouteConstants.chatSelectScreen, '/chat-select-screen');
|
||||
expect(RouteConstants.notificationsScreen, '/notifications-screen');
|
||||
expect(RouteConstants.menuScreen, '/menu-screen');
|
||||
});
|
||||
|
||||
test('has all content routes defined', () {
|
||||
expect(RouteConstants.aboutPlanScreen, '/about-plan-screen');
|
||||
expect(RouteConstants.aboutRecipesScreen, '/about-recipes-screen');
|
||||
expect(RouteConstants.aboutDietScreen, '/about-diet-screen');
|
||||
expect(RouteConstants.blogPostScreen, '/blog-post-screen');
|
||||
expect(RouteConstants.blogPostCreateScreen, '/blog-post-create-screen');
|
||||
});
|
||||
|
||||
test('has all profile routes defined', () {
|
||||
expect(RouteConstants.profileScreen, '/profile-screen');
|
||||
expect(RouteConstants.subsScreen, '/subs-screen');
|
||||
});
|
||||
|
||||
test('has all settings routes defined', () {
|
||||
expect(RouteConstants.settingsScreen, '/settings-screen');
|
||||
expect(RouteConstants.generalInfoScreen, 'general-info-screen');
|
||||
expect(RouteConstants.otherInfoScreen, 'other-info-screen');
|
||||
expect(RouteConstants.physicalActivityScreen, 'physical-activity-screen');
|
||||
expect(RouteConstants.physicalFormScreen, 'physical-form-screen');
|
||||
expect(RouteConstants.pressureScreen, 'pressure-screen');
|
||||
expect(RouteConstants.changePasswordScreen, 'change-password-screen');
|
||||
expect(RouteConstants.changeEmailScreen, 'change-email-screen');
|
||||
});
|
||||
|
||||
test('has all consultant routes defined', () {
|
||||
expect(RouteConstants.becomeConsultantScreen, '/become-consultant-screen');
|
||||
expect(RouteConstants.stepperBecomeConsultantScreen, '/stepper-become-consultant-screen');
|
||||
expect(RouteConstants.consultantRatingScreen, '/consultant-rating-screen');
|
||||
});
|
||||
|
||||
test('has all other routes defined', () {
|
||||
expect(RouteConstants.welcomeScreen, '/welcome-screen');
|
||||
expect(RouteConstants.updateScreen, '/update-screen');
|
||||
expect(RouteConstants.calendarScreen, '/calendar-screen');
|
||||
expect(RouteConstants.supportScreen, '/support-screen');
|
||||
expect(RouteConstants.photoViewScreen, '/photo-view-screen');
|
||||
expect(RouteConstants.chatScreen, '/chat-screen');
|
||||
expect(RouteConstants.emptyChatScreen, '/empty-chat-screen');
|
||||
expect(RouteConstants.glossaryScreen, '/glossary-screen');
|
||||
expect(RouteConstants.blockedUsersScreen, '/blocked-users-screen');
|
||||
expect(RouteConstants.notificationsSettingsScreen, '/notifications-settings-screen');
|
||||
});
|
||||
|
||||
test('has all finance routes defined', () {
|
||||
expect(RouteConstants.userFinanceScreen, '/user-finance-screen');
|
||||
expect(RouteConstants.cardSettingsScreen, '/card-settings-screen');
|
||||
expect(RouteConstants.orderInfoScreen, '/order-info-screen');
|
||||
expect(RouteConstants.paymentScreen, '/payment-screen');
|
||||
});
|
||||
|
||||
test('has all content creation routes defined', () {
|
||||
expect(RouteConstants.recipeCreateScreen, '/recipe-create-screen');
|
||||
expect(RouteConstants.createDietScreen, '/create-diet-screen');
|
||||
expect(RouteConstants.dietPreviewScreen, '/diet-preview-screen');
|
||||
expect(RouteConstants.createPlanScreen, '/create-plan-screen');
|
||||
expect(RouteConstants.myDietsScreen, '/my-diets-screen');
|
||||
expect(RouteConstants.myPlansScreen, '/my-plans-screen');
|
||||
expect(RouteConstants.myRecipesScreen, '/my-recipes-screen');
|
||||
});
|
||||
|
||||
test('has all user details routes defined', () {
|
||||
expect(RouteConstants.userDetailsScreen, '/user-details-screen');
|
||||
expect(RouteConstants.userDiaryScreen, '/user-diary-screen');
|
||||
});
|
||||
|
||||
test('has dev tools route defined', () {
|
||||
expect(RouteConstants.devToolsScreen, '/dev-tools-screen');
|
||||
});
|
||||
|
||||
test('has all archive routes defined', () {
|
||||
expect(RouteConstants.consultationsArchiveScreen, '/consultations-archive-screen');
|
||||
expect(RouteConstants.consultantFinancesScreen, '/consultant-finances-screen');
|
||||
expect(RouteConstants.userPurchasesScreen, '/user-purchases-screen');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,51 +1,55 @@
|
||||
import 'package:eatvio_app/core/routing/settings_routes.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
void main() {
|
||||
group('SettingsRoutes', () {
|
||||
test('createRoutes возвращает список маршрутов', () {
|
||||
final routes = SettingsRoutes.createRoutes();
|
||||
expect(routes, isNotEmpty);
|
||||
expect(routes, isA<List<RouteBase>>());
|
||||
});
|
||||
|
||||
test('createRoutes содержит маршрут settingsScreen', () {
|
||||
final routes = SettingsRoutes.createRoutes();
|
||||
final settingsRoute = routes.first as GoRoute;
|
||||
expect(settingsRoute.path, '/settings-screen');
|
||||
});
|
||||
|
||||
test('createRoutes содержит вложенные маршруты', () {
|
||||
final routes = SettingsRoutes.createRoutes();
|
||||
final settingsRoute = routes.first as GoRoute;
|
||||
expect(settingsRoute.routes, isNotEmpty);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/core/routing/settings_routes.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
void main() {
|
||||
group('SettingsRoutes', () {
|
||||
test('createRoutes возвращает список маршрутов', () {
|
||||
final routes = SettingsRoutes.createRoutes();
|
||||
expect(routes, isNotEmpty);
|
||||
expect(routes, isA<List<RouteBase>>());
|
||||
});
|
||||
|
||||
test('createRoutes содержит маршрут settingsScreen', () {
|
||||
final routes = SettingsRoutes.createRoutes();
|
||||
final settingsRoute = routes.first as GoRoute;
|
||||
expect(settingsRoute.path, '/settings-screen');
|
||||
});
|
||||
|
||||
test('createRoutes содержит вложенные маршруты', () {
|
||||
final routes = SettingsRoutes.createRoutes();
|
||||
final settingsRoute = routes.first as GoRoute;
|
||||
expect(settingsRoute.routes, isNotEmpty);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,45 +1,49 @@
|
||||
import 'package:eatvio_app/core/views/cubit/views_state.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('ViewsCubitState', () {
|
||||
test('creates initial state', () {
|
||||
final state = ViewsCubitState();
|
||||
|
||||
expect(state, isA<ViewsCubitState>());
|
||||
});
|
||||
|
||||
test('can create multiple instances', () {
|
||||
final state1 = ViewsCubitState();
|
||||
final state2 = ViewsCubitState();
|
||||
|
||||
expect(state1, isA<ViewsCubitState>());
|
||||
expect(state2, isA<ViewsCubitState>());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/core/views/cubit/views_state.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('ViewsCubitState', () {
|
||||
test('creates initial state', () {
|
||||
final state = ViewsCubitState();
|
||||
|
||||
expect(state, isA<ViewsCubitState>());
|
||||
});
|
||||
|
||||
test('can create multiple instances', () {
|
||||
final state1 = ViewsCubitState();
|
||||
final state2 = ViewsCubitState();
|
||||
|
||||
expect(state1, isA<ViewsCubitState>());
|
||||
expect(state2, isA<ViewsCubitState>());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,35 +1,31 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/add_item_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
void main() {
|
||||
group('AddItemButton smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp.router(
|
||||
theme: ThemeHelper().themeData(),
|
||||
routerConfig: GoRouter(
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/',
|
||||
builder: (context, state) => Scaffold(body: child),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/blog-post-create',
|
||||
name: 'blogPostCreateScreen',
|
||||
builder: (context, state) => const SizedBox.shrink(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders add item button', (tester) async {
|
||||
await tester.pumpWidget(wrap(const AddItemButton()));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(AddItemButton), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/add_item_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
void main() {
|
||||
group('AddItemButton smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp.router(
|
||||
theme: ThemeHelper().themeData(),
|
||||
routerConfig: GoRouter(
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/',
|
||||
builder: (context, state) => Scaffold(body: child),
|
||||
),
|
||||
GoRoute(path: '/blog-post-create', name: 'blogPostCreateScreen', builder: (context, state) => const SizedBox.shrink()),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders add item button', (tester) async {
|
||||
await tester.pumpWidget(wrap(const AddItemButton()));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(AddItemButton), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/animated_option_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('AnimatedOptionButton smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders animated option button', (tester) async {
|
||||
await tester.pumpWidget(wrap(AnimatedOptionButton(text: 'Option 1', isSelected: false, onTap: () {})));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(AnimatedOptionButton), findsOneWidget);
|
||||
expect(find.text('Option 1'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders animated option button as selected', (tester) async {
|
||||
await tester.pumpWidget(wrap(AnimatedOptionButton(text: 'Option 2', isSelected: true, onTap: () {})));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(AnimatedOptionButton), findsOneWidget);
|
||||
expect(find.text('Option 2'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/animated_option_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('AnimatedOptionButton smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders animated option button', (tester) async {
|
||||
await tester.pumpWidget(wrap(AnimatedOptionButton(text: 'Option 1', isSelected: false, onTap: () {})));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(AnimatedOptionButton), findsOneWidget);
|
||||
expect(find.text('Option 1'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders animated option button as selected', (tester) async {
|
||||
await tester.pumpWidget(wrap(AnimatedOptionButton(text: 'Option 2', isSelected: true, onTap: () {})));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(AnimatedOptionButton), findsOneWidget);
|
||||
expect(find.text('Option 2'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,70 +1,74 @@
|
||||
import 'package:eatvio_app/core/widgets/base_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('BaseButton', () {
|
||||
testWidgets('renders as SizedBox.shrink', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: BaseButton(
|
||||
text: 'Test Button',
|
||||
onPressed: () {},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(BaseButton), findsOneWidget);
|
||||
expect(find.byType(SizedBox), findsWidgets);
|
||||
});
|
||||
|
||||
testWidgets('accepts all parameters', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: BaseButton(
|
||||
text: 'Test Button',
|
||||
onPressed: () {},
|
||||
buttonStyle: const ButtonStyle(),
|
||||
buttonTextStyle: const TextStyle(),
|
||||
isDisabled: false,
|
||||
height: 50.0,
|
||||
width: 100.0,
|
||||
margin: const EdgeInsets.all(10),
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(BaseButton), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/core/widgets/base_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('BaseButton', () {
|
||||
testWidgets('renders as SizedBox.shrink', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: BaseButton(
|
||||
text: 'Test Button',
|
||||
onPressed: () {},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(BaseButton), findsOneWidget);
|
||||
expect(find.byType(SizedBox), findsWidgets);
|
||||
});
|
||||
|
||||
testWidgets('accepts all parameters', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: BaseButton(
|
||||
text: 'Test Button',
|
||||
onPressed: () {},
|
||||
buttonStyle: const ButtonStyle(),
|
||||
buttonTextStyle: const TextStyle(),
|
||||
isDisabled: false,
|
||||
height: 50.0,
|
||||
width: 100.0,
|
||||
margin: const EdgeInsets.all(10),
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(BaseButton), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,152 +1,156 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/bottom_sheet_with_blur.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('showBottomSheetWithBlur', () {
|
||||
testWidgets('shows bottom sheet with blur', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
return Scaffold(
|
||||
body: ElevatedButton(
|
||||
onPressed: () {
|
||||
showBottomSheetWithBlur(
|
||||
context: context,
|
||||
child: const Text('Test Content'),
|
||||
);
|
||||
},
|
||||
child: const Text('Show Bottom Sheet'),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Show Bottom Sheet'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Test Content'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('shows bottom sheet without blur when hasBlur is false', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
return Scaffold(
|
||||
body: ElevatedButton(
|
||||
onPressed: () {
|
||||
showBottomSheetWithBlur(
|
||||
context: context,
|
||||
child: const Text('Test Content'),
|
||||
hasBlur: false,
|
||||
);
|
||||
},
|
||||
child: const Text('Show Bottom Sheet'),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Show Bottom Sheet'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Test Content'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('accepts custom height', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
return Scaffold(
|
||||
body: ElevatedButton(
|
||||
onPressed: () {
|
||||
showBottomSheetWithBlur(
|
||||
context: context,
|
||||
child: const Text('Test Content'),
|
||||
height: 300.0,
|
||||
);
|
||||
},
|
||||
child: const Text('Show Bottom Sheet'),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Show Bottom Sheet'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Test Content'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('can be dismissed', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
return Scaffold(
|
||||
body: ElevatedButton(
|
||||
onPressed: () {
|
||||
showBottomSheetWithBlur(
|
||||
context: context,
|
||||
child: const Text('Test Content'),
|
||||
);
|
||||
},
|
||||
child: const Text('Show Bottom Sheet'),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Show Bottom Sheet'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Test Content'), findsOneWidget);
|
||||
|
||||
await tester.tapAt(const Offset(0, 0));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Test Content'), findsNothing);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/bottom_sheet_with_blur.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('showBottomSheetWithBlur', () {
|
||||
testWidgets('shows bottom sheet with blur', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
return Scaffold(
|
||||
body: ElevatedButton(
|
||||
onPressed: () {
|
||||
showBottomSheetWithBlur(
|
||||
context: context,
|
||||
child: const Text('Test Content'),
|
||||
);
|
||||
},
|
||||
child: const Text('Show Bottom Sheet'),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Show Bottom Sheet'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Test Content'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('shows bottom sheet without blur when hasBlur is false', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
return Scaffold(
|
||||
body: ElevatedButton(
|
||||
onPressed: () {
|
||||
showBottomSheetWithBlur(
|
||||
context: context,
|
||||
child: const Text('Test Content'),
|
||||
hasBlur: false,
|
||||
);
|
||||
},
|
||||
child: const Text('Show Bottom Sheet'),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Show Bottom Sheet'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Test Content'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('accepts custom height', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
return Scaffold(
|
||||
body: ElevatedButton(
|
||||
onPressed: () {
|
||||
showBottomSheetWithBlur(
|
||||
context: context,
|
||||
child: const Text('Test Content'),
|
||||
height: 300.0,
|
||||
);
|
||||
},
|
||||
child: const Text('Show Bottom Sheet'),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Show Bottom Sheet'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Test Content'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('can be dismissed', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
return Scaffold(
|
||||
body: ElevatedButton(
|
||||
onPressed: () {
|
||||
showBottomSheetWithBlur(
|
||||
context: context,
|
||||
child: const Text('Test Content'),
|
||||
);
|
||||
},
|
||||
child: const Text('Show Bottom Sheet'),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Show Bottom Sheet'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Test Content'), findsOneWidget);
|
||||
|
||||
await tester.tapAt(const Offset(0, 0));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Test Content'), findsNothing);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/cpfc_container.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('CpfcContainer smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: const [Locale('ru')],
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders cpfc container', (tester) async {
|
||||
await tester.pumpWidget(wrap(const CpfcContainer(calories: 2000.0, proteins: 150.0, fats: 80.0, carbohydrates: 250.0)));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(CpfcContainer), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/cpfc_container.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('CpfcContainer smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: const [Locale('ru')],
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders cpfc container', (tester) async {
|
||||
await tester.pumpWidget(wrap(const CpfcContainer(calories: 2000.0, proteins: 150.0, fats: 80.0, carbohydrates: 250.0)));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(CpfcContainer), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,37 +1,160 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/custom_search_bar.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('CustomSearchBar smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders custom search bar', (tester) async {
|
||||
final controller = TextEditingController();
|
||||
await tester.pumpWidget(wrap(CustomSearchBar(searchController: controller, onChanged: (_) {})));
|
||||
await tester.pump();
|
||||
expect(find.byType(CustomSearchBar), findsOneWidget);
|
||||
expect(find.byType(TextFormField), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders custom search bar with icon', (tester) async {
|
||||
final controller = TextEditingController();
|
||||
await tester.pumpWidget(wrap(CustomSearchBar(searchController: controller, onChanged: (_) {}, enableIcon: true)));
|
||||
await tester.pump();
|
||||
expect(find.byIcon(Icons.search), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders custom search bar without icon', (tester) async {
|
||||
final controller = TextEditingController();
|
||||
await tester.pumpWidget(wrap(CustomSearchBar(searchController: controller, onChanged: (_) {}, enableIcon: false)));
|
||||
await tester.pump();
|
||||
expect(find.byIcon(Icons.search), findsNothing);
|
||||
});
|
||||
});
|
||||
}
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/custom_search_bar.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('CustomSearchBar smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders custom search bar', (tester) async {
|
||||
final controller = TextEditingController();
|
||||
await tester.pumpWidget(wrap(CustomSearchBar(searchController: controller, onChanged: (_) {})));
|
||||
await tester.pump();
|
||||
expect(find.byType(CustomSearchBar), findsOneWidget);
|
||||
expect(find.byType(TextFormField), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders custom search bar with icon', (tester) async {
|
||||
final controller = TextEditingController();
|
||||
await tester.pumpWidget(wrap(CustomSearchBar(searchController: controller, onChanged: (_) {}, enableIcon: true)));
|
||||
await tester.pump();
|
||||
expect(find.byIcon(Icons.search), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders custom search bar without icon', (tester) async {
|
||||
final controller = TextEditingController();
|
||||
await tester.pumpWidget(wrap(CustomSearchBar(searchController: controller, onChanged: (_) {}, enableIcon: false)));
|
||||
await tester.pump();
|
||||
expect(find.byIcon(Icons.search), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('calls onChanged when text is entered', (tester) async {
|
||||
final controller = TextEditingController();
|
||||
String? changedValue;
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(
|
||||
body: CustomSearchBar(
|
||||
searchController: controller,
|
||||
onChanged: (value) {
|
||||
changedValue = value;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.enterText(find.byType(TextFormField), 'test');
|
||||
await tester.pump();
|
||||
|
||||
expect(changedValue, 'test');
|
||||
});
|
||||
|
||||
testWidgets('displays hint text', (tester) async {
|
||||
final controller = TextEditingController();
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(
|
||||
body: CustomSearchBar(
|
||||
searchController: controller,
|
||||
onChanged: (value) {},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text('Поиск'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('accepts custom width', (tester) async {
|
||||
final controller = TextEditingController();
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(
|
||||
body: CustomSearchBar(
|
||||
searchController: controller,
|
||||
onChanged: (value) {},
|
||||
width: 200.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(CustomSearchBar), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('accepts custom backgroundColor', (tester) async {
|
||||
final controller = TextEditingController();
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(
|
||||
body: CustomSearchBar(
|
||||
searchController: controller,
|
||||
onChanged: (value) {},
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(CustomSearchBar), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('accepts custom borderRadius', (tester) async {
|
||||
final controller = TextEditingController();
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(
|
||||
body: CustomSearchBar(
|
||||
searchController: controller,
|
||||
onChanged: (value) {},
|
||||
borderRadius: 20.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(CustomSearchBar), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
import 'package:eatvio_app/core/app_config.dart';
|
||||
import 'package:eatvio_app/core/app_initializer.dart';
|
||||
import 'package:eatvio_app/core/locator_service.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/item_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('ItemWidget smoke', () {
|
||||
setUpAll(() async {
|
||||
dotenv.loadFromString(envString: 'DEV_BASE_URL=http://localhost\nBASE_URL=http://localhost');
|
||||
});
|
||||
|
||||
setUp(() async {
|
||||
await sl.reset();
|
||||
sl.registerLazySingleton<AppConfig>(() => AppConfig(buildType: AppBuildType.tests)..setBaseUrl('http://localhost'));
|
||||
});
|
||||
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders item widget', (tester) async {
|
||||
await tester.pumpWidget(wrap(const ItemWidget(text: 'Test Item')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(ItemWidget), findsOneWidget);
|
||||
expect(find.text('Test Item'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders item widget reversed', (tester) async {
|
||||
await tester.pumpWidget(wrap(const ItemWidget(text: 'Test Item', reversed: true)));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(ItemWidget), findsOneWidget);
|
||||
expect(find.text('Test Item'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
import 'package:eatvio_app/core/app_config.dart';
|
||||
import 'package:eatvio_app/core/app_initializer.dart';
|
||||
import 'package:eatvio_app/core/locator_service.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/item_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('ItemWidget smoke', () {
|
||||
setUpAll(() async {
|
||||
dotenv.loadFromString(envString: 'DEV_BASE_URL=http://localhost\nBASE_URL=http://localhost');
|
||||
});
|
||||
|
||||
setUp(() async {
|
||||
await sl.reset();
|
||||
sl.registerLazySingleton<AppConfig>(() => AppConfig(buildType: AppBuildType.tests)..setBaseUrl('http://localhost'));
|
||||
});
|
||||
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders item widget', (tester) async {
|
||||
await tester.pumpWidget(wrap(const ItemWidget(text: 'Test Item')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(ItemWidget), findsOneWidget);
|
||||
expect(find.text('Test Item'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders item widget reversed', (tester) async {
|
||||
await tester.pumpWidget(wrap(const ItemWidget(text: 'Test Item', reversed: true)));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(ItemWidget), findsOneWidget);
|
||||
expect(find.text('Test Item'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('Loader smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders loader', (tester) async {
|
||||
await tester.pumpWidget(wrap(const Loader()));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(Loader), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/loader.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('Loader smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders loader', (tester) async {
|
||||
await tester.pumpWidget(wrap(const Loader()));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(Loader), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/main_background_bouble.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('MainBackgroundBouble smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders main background bouble', (tester) async {
|
||||
await tester.pumpWidget(wrap(const MainBackgroundBouble(child: Text('Test'))));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(MainBackgroundBouble), findsOneWidget);
|
||||
expect(find.text('Test'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders main background bouble with error', (tester) async {
|
||||
await tester.pumpWidget(wrap(const MainBackgroundBouble(hasError: true, child: Text('Test'))));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(MainBackgroundBouble), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders main background bouble with shadow', (tester) async {
|
||||
await tester.pumpWidget(wrap(const MainBackgroundBouble(enableShadow: true, child: Text('Test'))));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(MainBackgroundBouble), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/main_background_bouble.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('MainBackgroundBouble smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders main background bouble', (tester) async {
|
||||
await tester.pumpWidget(wrap(const MainBackgroundBouble(child: Text('Test'))));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(MainBackgroundBouble), findsOneWidget);
|
||||
expect(find.text('Test'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders main background bouble with error', (tester) async {
|
||||
await tester.pumpWidget(wrap(const MainBackgroundBouble(hasError: true, child: Text('Test'))));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(MainBackgroundBouble), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders main background bouble with shadow', (tester) async {
|
||||
await tester.pumpWidget(wrap(const MainBackgroundBouble(enableShadow: true, child: Text('Test'))));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(MainBackgroundBouble), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,93 +1,97 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/marketing_bottom_sheet.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('MarketingBottomSheet', () {
|
||||
Widget createTestWidget(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
home: Scaffold(
|
||||
body: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('displays marketing bottom sheet', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
createTestWidget(
|
||||
const MarketingBottomSheet(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(MarketingBottomSheet), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('shows marketing bottom sheet via function', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
return Scaffold(
|
||||
body: ElevatedButton(
|
||||
onPressed: () {
|
||||
showMarketingBottomSheet(context);
|
||||
},
|
||||
child: const Text('Show'),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Show'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(MarketingBottomSheet), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/marketing_bottom_sheet.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('MarketingBottomSheet', () {
|
||||
Widget createTestWidget(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
home: Scaffold(
|
||||
body: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('displays marketing bottom sheet', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
createTestWidget(
|
||||
const MarketingBottomSheet(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(MarketingBottomSheet), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('shows marketing bottom sheet via function', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
return Scaffold(
|
||||
body: ElevatedButton(
|
||||
onPressed: () {
|
||||
showMarketingBottomSheet(context);
|
||||
},
|
||||
child: const Text('Show'),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Show'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(MarketingBottomSheet), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,82 +1,86 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/option_widget.dart';
|
||||
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('OptionWidget', () {
|
||||
Widget createTestWidget(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('returns SizedBox.shrink when option is null', (tester) async {
|
||||
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 {
|
||||
const option = PacketOptions(items: ['Item 1', 'Item 2'], price: 1000.0, short: 'Short', description: 'Description', hasPersonalDiet: false);
|
||||
|
||||
await tester.pumpWidget(createTestWidget(const OptionWidget(option: option, duration: 7)));
|
||||
|
||||
expect(find.byType(OptionWidget), findsOneWidget);
|
||||
expect(find.text('Short'), findsOneWidget);
|
||||
expect(find.text('Description'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays option widget with personal diet', (tester) async {
|
||||
const option = PacketOptions(items: ['Item 1'], price: 1000.0, short: 'Short', description: 'Description', hasPersonalDiet: true);
|
||||
|
||||
await tester.pumpWidget(createTestWidget(const OptionWidget(option: option, duration: 7)));
|
||||
|
||||
expect(find.byType(OptionWidget), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('hides duration when disableDuration is true', (tester) async {
|
||||
const option = PacketOptions(items: ['Item 1'], price: 1000.0, short: 'Short', description: 'Description', hasPersonalDiet: false);
|
||||
|
||||
await tester.pumpWidget(createTestWidget(const OptionWidget(option: option, duration: 7, disableDuration: true)));
|
||||
|
||||
expect(find.byType(OptionWidget), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/option_widget.dart';
|
||||
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('OptionWidget', () {
|
||||
Widget createTestWidget(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('returns SizedBox.shrink when option is null', (tester) async {
|
||||
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 {
|
||||
const option = PacketOptions(items: ['Item 1', 'Item 2'], price: 1000.0, short: 'Short', description: 'Description', hasPersonalDiet: false);
|
||||
|
||||
await tester.pumpWidget(createTestWidget(const OptionWidget(option: option, duration: 7)));
|
||||
|
||||
expect(find.byType(OptionWidget), findsOneWidget);
|
||||
expect(find.text('Short'), findsOneWidget);
|
||||
expect(find.text('Description'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays option widget with personal diet', (tester) async {
|
||||
const option = PacketOptions(items: ['Item 1'], price: 1000.0, short: 'Short', description: 'Description', hasPersonalDiet: true);
|
||||
|
||||
await tester.pumpWidget(createTestWidget(const OptionWidget(option: option, duration: 7)));
|
||||
|
||||
expect(find.byType(OptionWidget), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('hides duration when disableDuration is true', (tester) async {
|
||||
const option = PacketOptions(items: ['Item 1'], price: 1000.0, short: 'Short', description: 'Description', hasPersonalDiet: false);
|
||||
|
||||
await tester.pumpWidget(createTestWidget(const OptionWidget(option: option, duration: 7, disableDuration: true)));
|
||||
|
||||
expect(find.byType(OptionWidget), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/create_diet/presentation/widgets/error_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('ValidationErrorWidget smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders validation error widget', (tester) async {
|
||||
await tester.pumpWidget(wrap(const ValidationErrorWidget(error: 'Test error')));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(ValidationErrorWidget), findsOneWidget);
|
||||
expect(find.text('Test error'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/create_diet/presentation/widgets/error_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('ValidationErrorWidget smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders validation error widget', (tester) async {
|
||||
await tester.pumpWidget(wrap(const ValidationErrorWidget(error: 'Test error')));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(ValidationErrorWidget), findsOneWidget);
|
||||
expect(find.text('Test error'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,97 +1,101 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/diary/presentation/widgets/chosen_diet_widget.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('ChosenDietWidgetContent', () {
|
||||
Widget createTestWidget(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
home: Scaffold(
|
||||
body: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('displays chosen diet widget content', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
createTestWidget(
|
||||
const ChosenDietWidgetContent(
|
||||
currentDietDay: 5,
|
||||
dietName: 'Test Diet',
|
||||
dietDuration: 14,
|
||||
dietId: 1,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(ChosenDietWidgetContent), findsOneWidget);
|
||||
expect(find.text('Test Diet'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays current day and duration', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
createTestWidget(
|
||||
const ChosenDietWidgetContent(
|
||||
currentDietDay: 7,
|
||||
dietName: 'Test Diet',
|
||||
dietDuration: 21,
|
||||
dietId: 1,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(ChosenDietWidgetContent), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays diet name with underline', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
createTestWidget(
|
||||
const ChosenDietWidgetContent(
|
||||
currentDietDay: 1,
|
||||
dietName: 'My Diet',
|
||||
dietDuration: 7,
|
||||
dietId: 1,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text('My Diet'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/diary/presentation/widgets/chosen_diet_widget.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('ChosenDietWidgetContent', () {
|
||||
Widget createTestWidget(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: const [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
home: Scaffold(
|
||||
body: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('displays chosen diet widget content', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
createTestWidget(
|
||||
const ChosenDietWidgetContent(
|
||||
currentDietDay: 5,
|
||||
dietName: 'Test Diet',
|
||||
dietDuration: 14,
|
||||
dietId: 1,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(ChosenDietWidgetContent), findsOneWidget);
|
||||
expect(find.text('Test Diet'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays current day and duration', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
createTestWidget(
|
||||
const ChosenDietWidgetContent(
|
||||
currentDietDay: 7,
|
||||
dietName: 'Test Diet',
|
||||
dietDuration: 21,
|
||||
dietId: 1,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(ChosenDietWidgetContent), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays diet name with underline', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
createTestWidget(
|
||||
const ChosenDietWidgetContent(
|
||||
currentDietDay: 1,
|
||||
dietName: 'My Diet',
|
||||
dietDuration: 7,
|
||||
dietId: 1,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text('My Diet'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,75 +1,79 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/diary/presentation/widgets/comment_container.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('CommentContainer', () {
|
||||
testWidgets('displays comment text', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: const Scaffold(
|
||||
body: CommentContainer(comment: 'Test comment'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(CommentContainer), findsOneWidget);
|
||||
expect(find.text('Test comment'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays empty comment', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: const Scaffold(
|
||||
body: CommentContainer(comment: ''),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(CommentContainer), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays long comment', (tester) async {
|
||||
const longComment = 'This is a very long comment that should be displayed properly in the container';
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: const Scaffold(
|
||||
body: CommentContainer(comment: longComment),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(CommentContainer), findsOneWidget);
|
||||
expect(find.text(longComment), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/diary/presentation/widgets/comment_container.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('CommentContainer', () {
|
||||
testWidgets('displays comment text', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: const Scaffold(
|
||||
body: CommentContainer(comment: 'Test comment'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(CommentContainer), findsOneWidget);
|
||||
expect(find.text('Test comment'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays empty comment', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: const Scaffold(
|
||||
body: CommentContainer(comment: ''),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(CommentContainer), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays long comment', (tester) async {
|
||||
const longComment = 'This is a very long comment that should be displayed properly in the container';
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: const Scaffold(
|
||||
body: CommentContainer(comment: longComment),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(CommentContainer), findsOneWidget);
|
||||
expect(find.text(longComment), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import 'package:eatvio_app/features/diary/presentation/widgets/finish_day_button_widget.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('FinishDayButtonWidget smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders finish day button widget', (tester) async {
|
||||
await tester.pumpWidget(wrap(FinishDayButtonWidget(onPressed: () async {})));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(FinishDayButtonWidget), findsOneWidget);
|
||||
expect(find.text('Закончить день'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
import 'package:eatvio_app/features/diary/presentation/widgets/finish_day_button_widget.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('FinishDayButtonWidget smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders finish day button widget', (tester) async {
|
||||
await tester.pumpWidget(wrap(FinishDayButtonWidget(onPressed: () async {})));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(FinishDayButtonWidget), findsOneWidget);
|
||||
expect(find.text('Закончить день'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,107 +1,111 @@
|
||||
import 'package:eatvio_app/features/diary/models/diary_day_model.dart';
|
||||
import 'package:eatvio_app/features/diary/presentation/widgets/meal_summary_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('MealSummaryWidget', () {
|
||||
testWidgets('displays meal summary with totals', (tester) async {
|
||||
final portions = <PortionModel>[];
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: MealSummaryWidget(
|
||||
portions: portions,
|
||||
mealNumber: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(MealSummaryWidget), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('hides when all totals are zero', (tester) async {
|
||||
final portions = <PortionModel>[];
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: MealSummaryWidget(
|
||||
portions: portions,
|
||||
mealNumber: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Widget should be hidden (SizedBox.shrink) when totals are zero
|
||||
expect(find.byType(MealSummaryWidget), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays meal number', (tester) async {
|
||||
final portions = <PortionModel>[];
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: MealSummaryWidget(
|
||||
portions: portions,
|
||||
mealNumber: 3,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(MealSummaryWidget), findsOneWidget);
|
||||
});
|
||||
});
|
||||
|
||||
group('MealSummaryWidget.calculateMealTotals', () {
|
||||
test('returns zero totals for empty portions list', () {
|
||||
final result = MealSummaryWidget.calculateMealTotals([]);
|
||||
|
||||
expect(result['calories'], 0.0);
|
||||
expect(result['proteins'], 0.0);
|
||||
expect(result['fats'], 0.0);
|
||||
expect(result['carbohydrates'], 0.0);
|
||||
});
|
||||
|
||||
test('returns correct map structure', () {
|
||||
final result = MealSummaryWidget.calculateMealTotals([]);
|
||||
|
||||
expect(result.containsKey('calories'), isTrue);
|
||||
expect(result.containsKey('proteins'), isTrue);
|
||||
expect(result.containsKey('fats'), isTrue);
|
||||
expect(result.containsKey('carbohydrates'), isTrue);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/features/diary/models/diary_day_model.dart';
|
||||
import 'package:eatvio_app/features/diary/presentation/widgets/meal_summary_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('MealSummaryWidget', () {
|
||||
testWidgets('displays meal summary with totals', (tester) async {
|
||||
final portions = <PortionModel>[];
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: MealSummaryWidget(
|
||||
portions: portions,
|
||||
mealNumber: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(MealSummaryWidget), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('hides when all totals are zero', (tester) async {
|
||||
final portions = <PortionModel>[];
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: MealSummaryWidget(
|
||||
portions: portions,
|
||||
mealNumber: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Widget should be hidden (SizedBox.shrink) when totals are zero
|
||||
expect(find.byType(MealSummaryWidget), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays meal number', (tester) async {
|
||||
final portions = <PortionModel>[];
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: MealSummaryWidget(
|
||||
portions: portions,
|
||||
mealNumber: 3,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(MealSummaryWidget), findsOneWidget);
|
||||
});
|
||||
});
|
||||
|
||||
group('MealSummaryWidget.calculateMealTotals', () {
|
||||
test('returns zero totals for empty portions list', () {
|
||||
final result = MealSummaryWidget.calculateMealTotals([]);
|
||||
|
||||
expect(result['calories'], 0.0);
|
||||
expect(result['proteins'], 0.0);
|
||||
expect(result['fats'], 0.0);
|
||||
expect(result['carbohydrates'], 0.0);
|
||||
});
|
||||
|
||||
test('returns correct map structure', () {
|
||||
final result = MealSummaryWidget.calculateMealTotals([]);
|
||||
|
||||
expect(result.containsKey('calories'), isTrue);
|
||||
expect(result.containsKey('proteins'), isTrue);
|
||||
expect(result.containsKey('fats'), isTrue);
|
||||
expect(result.containsKey('carbohydrates'), isTrue);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,59 +1,63 @@
|
||||
import 'package:eatvio_app/features/diary/presentation/widgets/product_loader_widget.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('ProductLoaderWidget', () {
|
||||
testWidgets('displays product loader widget', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: ProductLoaderWidget(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(ProductLoaderWidget), findsOneWidget);
|
||||
expect(find.byType(CupertinoActivityIndicator), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays ListTile with activity indicator', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: ProductLoaderWidget(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(ListTile), findsOneWidget);
|
||||
expect(find.byType(CupertinoActivityIndicator), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/features/diary/presentation/widgets/product_loader_widget.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('ProductLoaderWidget', () {
|
||||
testWidgets('displays product loader widget', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: ProductLoaderWidget(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(ProductLoaderWidget), findsOneWidget);
|
||||
expect(find.byType(CupertinoActivityIndicator), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays ListTile with activity indicator', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: ProductLoaderWidget(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(ListTile), findsOneWidget);
|
||||
expect(find.byType(CupertinoActivityIndicator), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/diets/presentation/widgets/info_bouble.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('InfoBouble smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders info bouble', (tester) async {
|
||||
await tester.pumpWidget(wrap(const InfoBouble(children: [Text('Test')])));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(InfoBouble), findsOneWidget);
|
||||
expect(find.text('Test'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders info bouble with multiple children', (tester) async {
|
||||
await tester.pumpWidget(wrap(const InfoBouble(children: [Icon(Icons.star), Text('Test')])));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(InfoBouble), findsOneWidget);
|
||||
expect(find.byIcon(Icons.star), findsOneWidget);
|
||||
expect(find.text('Test'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders info bouble with custom background color', (tester) async {
|
||||
await tester.pumpWidget(wrap(const InfoBouble(backgroundColor: Colors.blue, children: [Text('Test')])));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(InfoBouble), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/diets/presentation/widgets/info_bouble.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('InfoBouble smoke', () {
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders info bouble', (tester) async {
|
||||
await tester.pumpWidget(wrap(const InfoBouble(children: [Text('Test')])));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(InfoBouble), findsOneWidget);
|
||||
expect(find.text('Test'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders info bouble with multiple children', (tester) async {
|
||||
await tester.pumpWidget(wrap(const InfoBouble(children: [Icon(Icons.star), Text('Test')])));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(InfoBouble), findsOneWidget);
|
||||
expect(find.byIcon(Icons.star), findsOneWidget);
|
||||
expect(find.text('Test'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders info bouble with custom background color', (tester) async {
|
||||
await tester.pumpWidget(wrap(const InfoBouble(backgroundColor: Colors.blue, children: [Text('Test')])));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(InfoBouble), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,59 +1,59 @@
|
||||
import 'package:eatvio_app/core/app_config.dart';
|
||||
import 'package:eatvio_app/core/app_initializer.dart';
|
||||
import 'package:eatvio_app/core/locator_service.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/widgets/choice_chip_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('ChoiceChipWidget smoke', () {
|
||||
setUpAll(() async {
|
||||
dotenv.loadFromString(envString: 'DEV_BASE_URL=http://localhost\nBASE_URL=http://localhost');
|
||||
});
|
||||
|
||||
setUp(() async {
|
||||
await sl.reset();
|
||||
sl.registerLazySingleton<AppConfig>(() => AppConfig(buildType: AppBuildType.tests)..setBaseUrl('http://localhost'));
|
||||
});
|
||||
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders choice chip widget', (tester) async {
|
||||
final chipsList = ['Все', 'Рецепты', 'Диеты'];
|
||||
|
||||
|
||||
await tester.pumpWidget(
|
||||
wrap(
|
||||
ChoiceChipWidget(
|
||||
index: 0,
|
||||
selectedChipIndex: 0,
|
||||
chipsLabelList: chipsList,
|
||||
onSelected: (value) {
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(ChoiceChipWidget), findsOneWidget);
|
||||
expect(find.text('Все'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders choice chip widget not selected', (tester) async {
|
||||
final chipsList = ['Все', 'Рецепты', 'Диеты'];
|
||||
|
||||
await tester.pumpWidget(wrap(ChoiceChipWidget(index: 1, selectedChipIndex: 0, chipsLabelList: chipsList, onSelected: (value) {})));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(ChoiceChipWidget), findsOneWidget);
|
||||
expect(find.text('Рецепты'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
import 'package:eatvio_app/core/app_config.dart';
|
||||
import 'package:eatvio_app/core/app_initializer.dart';
|
||||
import 'package:eatvio_app/core/locator_service.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/widgets/choice_chip_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('ChoiceChipWidget smoke', () {
|
||||
setUpAll(() async {
|
||||
dotenv.loadFromString(envString: 'DEV_BASE_URL=http://localhost\nBASE_URL=http://localhost');
|
||||
});
|
||||
|
||||
setUp(() async {
|
||||
await sl.reset();
|
||||
sl.registerLazySingleton<AppConfig>(() => AppConfig(buildType: AppBuildType.tests)..setBaseUrl('http://localhost'));
|
||||
});
|
||||
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders choice chip widget', (tester) async {
|
||||
final chipsList = ['Все', 'Рецепты', 'Диеты'];
|
||||
|
||||
|
||||
await tester.pumpWidget(
|
||||
wrap(
|
||||
ChoiceChipWidget(
|
||||
index: 0,
|
||||
selectedChipIndex: 0,
|
||||
chipsLabelList: chipsList,
|
||||
onSelected: (value) {
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(ChoiceChipWidget), findsOneWidget);
|
||||
expect(find.text('Все'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders choice chip widget not selected', (tester) async {
|
||||
final chipsList = ['Все', 'Рецепты', 'Диеты'];
|
||||
|
||||
await tester.pumpWidget(wrap(ChoiceChipWidget(index: 1, selectedChipIndex: 0, chipsLabelList: chipsList, onSelected: (value) {})));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(ChoiceChipWidget), findsOneWidget);
|
||||
expect(find.text('Рецепты'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
import 'package:eatvio_app/core/app_config.dart';
|
||||
import 'package:eatvio_app/core/app_initializer.dart';
|
||||
import 'package:eatvio_app/core/locator_service.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/widgets/filter_badge.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('FilterBadge smoke', () {
|
||||
setUpAll(() async {
|
||||
dotenv.loadFromString(envString: 'DEV_BASE_URL=http://localhost\nBASE_URL=http://localhost');
|
||||
});
|
||||
|
||||
setUp(() async {
|
||||
await sl.reset();
|
||||
sl.registerLazySingleton<AppConfig>(() => AppConfig(buildType: AppBuildType.tests)..setBaseUrl('http://localhost'));
|
||||
});
|
||||
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders filter badge', (tester) async {
|
||||
await tester.pumpWidget(wrap(const FilterBadge(filterBottomSheet: Scaffold(body: Text('Filter Bottom Sheet')))));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(FilterBadge), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
import 'package:eatvio_app/core/app_config.dart';
|
||||
import 'package:eatvio_app/core/app_initializer.dart';
|
||||
import 'package:eatvio_app/core/locator_service.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/widgets/filter_badge.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('FilterBadge smoke', () {
|
||||
setUpAll(() async {
|
||||
dotenv.loadFromString(envString: 'DEV_BASE_URL=http://localhost\nBASE_URL=http://localhost');
|
||||
});
|
||||
|
||||
setUp(() async {
|
||||
await sl.reset();
|
||||
sl.registerLazySingleton<AppConfig>(() => AppConfig(buildType: AppBuildType.tests)..setBaseUrl('http://localhost'));
|
||||
});
|
||||
|
||||
Widget wrap(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders filter badge', (tester) async {
|
||||
await tester.pumpWidget(wrap(const FilterBadge(filterBottomSheet: Scaffold(body: Text('Filter Bottom Sheet')))));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(FilterBadge), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,75 +1,79 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/finances_and_consultations_archive/presentation/widgets/status_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('StatusWidget', () {
|
||||
testWidgets('displays canceled status', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: const Scaffold(
|
||||
body: StatusWidget(status: Status.canceled),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(StatusWidget), findsOneWidget);
|
||||
expect(find.text('Отменён'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays success status', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: const Scaffold(
|
||||
body: StatusWidget(status: Status.success),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(StatusWidget), findsOneWidget);
|
||||
expect(find.text('Успешно'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays inProgress status', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: const Scaffold(
|
||||
body: StatusWidget(status: Status.inProgress),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(StatusWidget), findsOneWidget);
|
||||
expect(find.text('В процессе'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/finances_and_consultations_archive/presentation/widgets/status_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('StatusWidget', () {
|
||||
testWidgets('displays canceled status', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: const Scaffold(
|
||||
body: StatusWidget(status: Status.canceled),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(StatusWidget), findsOneWidget);
|
||||
expect(find.text('Отменён'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays success status', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: const Scaffold(
|
||||
body: StatusWidget(status: Status.success),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(StatusWidget), findsOneWidget);
|
||||
expect(find.text('Успешно'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays inProgress status', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
home: const Scaffold(
|
||||
body: StatusWidget(status: Status.inProgress),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(StatusWidget), findsOneWidget);
|
||||
expect(find.text('В процессе'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,68 +1,72 @@
|
||||
import 'package:eatvio_app/features/glossary/models/glossary_model.dart';
|
||||
import 'package:eatvio_app/features/glossary/repositories/glossary_repository.dart';
|
||||
import 'package:eatvio_app/features/glossary/services/glossary_service.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
|
||||
class MockGlossaryService extends Mock implements GlossaryService {}
|
||||
|
||||
void main() {
|
||||
group('GlossaryRepository', () {
|
||||
late GlossaryRepository repository;
|
||||
late MockGlossaryService mockService;
|
||||
|
||||
setUp(() {
|
||||
mockService = MockGlossaryService();
|
||||
repository = GlossaryRepository(glossaryService: mockService);
|
||||
});
|
||||
|
||||
test('getGlossaryListByQuery - успешный запрос', () async {
|
||||
const query = 'test';
|
||||
final mockGlossaries = <GlossaryModel>[];
|
||||
final mockPagination = GlossaryPaginationModel(glossariesList: mockGlossaries);
|
||||
|
||||
when(() => mockService.getGlossaryByQuery(query: query))
|
||||
.thenAnswer((_) async => mockPagination);
|
||||
|
||||
final result = await repository.getGlossaryListByQuery(query);
|
||||
|
||||
expect(result, mockGlossaries);
|
||||
verify(() => mockService.getGlossaryByQuery(query: query)).called(1);
|
||||
});
|
||||
|
||||
test('getGlossaryListByQuery - пробрасывает ошибку', () async {
|
||||
const query = 'test';
|
||||
|
||||
when(() => mockService.getGlossaryByQuery(query: query))
|
||||
.thenThrow(Exception('Error'));
|
||||
|
||||
expect(() => repository.getGlossaryListByQuery(query), throwsException);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:eatvio_app/features/glossary/models/glossary_model.dart';
|
||||
import 'package:eatvio_app/features/glossary/repositories/glossary_repository.dart';
|
||||
import 'package:eatvio_app/features/glossary/services/glossary_service.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
|
||||
class MockGlossaryService extends Mock implements GlossaryService {}
|
||||
|
||||
void main() {
|
||||
group('GlossaryRepository', () {
|
||||
late GlossaryRepository repository;
|
||||
late MockGlossaryService mockService;
|
||||
|
||||
setUp(() {
|
||||
mockService = MockGlossaryService();
|
||||
repository = GlossaryRepository(glossaryService: mockService);
|
||||
});
|
||||
|
||||
test('getGlossaryListByQuery - успешный запрос', () async {
|
||||
const query = 'test';
|
||||
final mockGlossaries = <GlossaryModel>[];
|
||||
final mockPagination = GlossaryPaginationModel(glossariesList: mockGlossaries);
|
||||
|
||||
when(() => mockService.getGlossaryByQuery(query: query))
|
||||
.thenAnswer((_) async => mockPagination);
|
||||
|
||||
final result = await repository.getGlossaryListByQuery(query);
|
||||
|
||||
expect(result, mockGlossaries);
|
||||
verify(() => mockService.getGlossaryByQuery(query: query)).called(1);
|
||||
});
|
||||
|
||||
test('getGlossaryListByQuery - пробрасывает ошибку', () async {
|
||||
const query = 'test';
|
||||
|
||||
when(() => mockService.getGlossaryByQuery(query: query))
|
||||
.thenThrow(Exception('Error'));
|
||||
|
||||
expect(() => repository.getGlossaryListByQuery(query), throwsException);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,77 +1,81 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:eatvio_app/features/notifications/service/notifications_service.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
|
||||
import '../../../fixtures/fixture_reader.dart';
|
||||
import 'notifications_service_test.mocks.dart';
|
||||
|
||||
@GenerateNiceMocks([MockSpec<Dio>()])
|
||||
void main() {
|
||||
group('NotificationsService', () {
|
||||
late NotificationsService notificationsService;
|
||||
late MockDio mockDio;
|
||||
|
||||
setUp(() {
|
||||
mockDio = MockDio();
|
||||
notificationsService = NotificationsService(mockDio);
|
||||
});
|
||||
|
||||
test('getNotifications - возвращает уведомления', () async {
|
||||
const page = 1;
|
||||
final json = FixtureReader.readAsMap('notifications/notifications_response.json');
|
||||
final response = Response(
|
||||
data: {
|
||||
'data': json['notifications'],
|
||||
'current_page': json['pagination']['current_page'],
|
||||
'last_page': json['pagination']['last_page'],
|
||||
'per_page': 10,
|
||||
'total': 1,
|
||||
},
|
||||
statusCode: 200,
|
||||
requestOptions: RequestOptions(path: '/api/profile/notifications'),
|
||||
);
|
||||
|
||||
when(mockDio.get(any))
|
||||
.thenAnswer((_) async => response);
|
||||
|
||||
final result = await notificationsService.getNotifications(page: page);
|
||||
|
||||
expect(result, isA<Map<String, dynamic>?>());
|
||||
expect(result, isNotNull);
|
||||
expect(result!['notifications'], isA<List>());
|
||||
verify(mockDio.get(any)).called(1);
|
||||
});
|
||||
|
||||
test('markNotificationsAsRead - помечает уведомления как прочитанные', () async {
|
||||
final response = Response(
|
||||
data: {},
|
||||
statusCode: 200,
|
||||
requestOptions: RequestOptions(path: '/api/profile/mark_notifications_as_readed'),
|
||||
);
|
||||
|
||||
when(mockDio.post(any))
|
||||
.thenAnswer((_) async => response);
|
||||
|
||||
await notificationsService.markNotificationsAsRead();
|
||||
|
||||
verify(mockDio.post(any)).called(1);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:eatvio_app/features/notifications/service/notifications_service.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
|
||||
import '../../../fixtures/fixture_reader.dart';
|
||||
import 'notifications_service_test.mocks.dart';
|
||||
|
||||
@GenerateNiceMocks([MockSpec<Dio>()])
|
||||
void main() {
|
||||
group('NotificationsService', () {
|
||||
late NotificationsService notificationsService;
|
||||
late MockDio mockDio;
|
||||
|
||||
setUp(() {
|
||||
mockDio = MockDio();
|
||||
notificationsService = NotificationsService(mockDio);
|
||||
});
|
||||
|
||||
test('getNotifications - возвращает уведомления', () async {
|
||||
const page = 1;
|
||||
final json = FixtureReader.readAsMap('notifications/notifications_response.json');
|
||||
final response = Response(
|
||||
data: {
|
||||
'data': json['notifications'],
|
||||
'current_page': json['pagination']['current_page'],
|
||||
'last_page': json['pagination']['last_page'],
|
||||
'per_page': 10,
|
||||
'total': 1,
|
||||
},
|
||||
statusCode: 200,
|
||||
requestOptions: RequestOptions(path: '/api/profile/notifications'),
|
||||
);
|
||||
|
||||
when(mockDio.get(any))
|
||||
.thenAnswer((_) async => response);
|
||||
|
||||
final result = await notificationsService.getNotifications(page: page);
|
||||
|
||||
expect(result, isA<Map<String, dynamic>?>());
|
||||
expect(result, isNotNull);
|
||||
expect(result!['notifications'], isA<List>());
|
||||
verify(mockDio.get(any)).called(1);
|
||||
});
|
||||
|
||||
test('markNotificationsAsRead - помечает уведомления как прочитанные', () async {
|
||||
final response = Response(
|
||||
data: {},
|
||||
statusCode: 200,
|
||||
requestOptions: RequestOptions(path: '/api/profile/mark_notifications_as_readed'),
|
||||
);
|
||||
|
||||
when(mockDio.post(any))
|
||||
.thenAnswer((_) async => response);
|
||||
|
||||
await notificationsService.markNotificationsAsRead();
|
||||
|
||||
verify(mockDio.post(any)).called(1);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user