forked from eatvio/eatvio_app
feat(tests): added new tests and updated fixtures
This commit is contained in:
@@ -201,6 +201,7 @@ class CreateDietCubit extends Cubit<CreateDietState> {
|
||||
}
|
||||
|
||||
Future<Diet?> getDietForPreview() async {
|
||||
if (!_isFormValidForDraft()) return null;
|
||||
final authorProfile = await profileRepository.getMyProfile();
|
||||
final imageBytes = (await state.dietData.image?.readAsBytes()) ?? <int>[];
|
||||
String image = base64.encode(imageBytes);
|
||||
@@ -317,6 +318,11 @@ class CreateDietCubit extends Cubit<CreateDietState> {
|
||||
return 'validation';
|
||||
}
|
||||
try {
|
||||
final dietState = state.dietData.state;
|
||||
if (dietState == null) {
|
||||
emit(state.copyWith(isDietPublishing: false, dietStateError: 'Статус диеты не выбран'));
|
||||
return 'validation';
|
||||
}
|
||||
File? file;
|
||||
if (state.dietData.imageUrl != null) {
|
||||
file = await downloadImageAsFile(state.dietData.imageUrl!);
|
||||
@@ -325,7 +331,6 @@ class CreateDietCubit extends Cubit<CreateDietState> {
|
||||
if (state.dietData.image?.path != null) {
|
||||
image = await ImageCompressUtility.compressFile(File(state.dietData.image!.path));
|
||||
}
|
||||
final dietState = state.dietData.state!;
|
||||
final dailySchedule = state.dietData.dailySchedule;
|
||||
await createDietRepository.createDiet(
|
||||
name: state.dietData.name ?? '',
|
||||
|
||||
Reference in New Issue
Block a user