Merge pull request 'new test cases' (#218) from misha/eatvio_app:main into main

Reviewed-on: eatvio/eatvio_app#218
This commit is contained in:
BLoC
2025-01-29 11:35:18 +00:00
38 changed files with 897 additions and 460 deletions

View File

@@ -13,4 +13,4 @@ class Ingredient with _$Ingredient {
}) = _Ingredient;
factory Ingredient.fromJson(Map<String, Object?> json) => _$IngredientFromJson(json);
}
}

View File

@@ -11,13 +11,17 @@ class RecipeModel with _$RecipeModel {
const factory RecipeModel({
List<Ingredient?>? ingredients,
List<Step?>? steps,
List<String>? tags,
String? type,
String? state,
String? title,
String? description,
String? video_url,
String? image,
int? cooking_time,
int? totalCookingTime,
int? activeCookTime,
int? servings,
int? energyPerServing,
}) = _RecipeModel;
factory RecipeModel.fromJson(Map<String, Object?> json) => _$RecipeModelFromJson(json);

View File

@@ -22,13 +22,17 @@ RecipeModel _$RecipeModelFromJson(Map<String, dynamic> json) {
mixin _$RecipeModel {
List<Ingredient?>? get ingredients => throw _privateConstructorUsedError;
List<Step?>? get steps => throw _privateConstructorUsedError;
List<String>? get tags => throw _privateConstructorUsedError;
String? get type => throw _privateConstructorUsedError;
String? get state => throw _privateConstructorUsedError;
String? get title => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
String? get video_url => throw _privateConstructorUsedError;
String? get image => throw _privateConstructorUsedError;
int? get cooking_time => throw _privateConstructorUsedError;
int? get totalCookingTime => throw _privateConstructorUsedError;
int? get activeCookTime => throw _privateConstructorUsedError;
int? get servings => throw _privateConstructorUsedError;
int? get energyPerServing => throw _privateConstructorUsedError;
/// Serializes this RecipeModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -49,13 +53,17 @@ abstract class $RecipeModelCopyWith<$Res> {
$Res call(
{List<Ingredient?>? ingredients,
List<Step?>? steps,
List<String>? tags,
String? type,
String? state,
String? title,
String? description,
String? video_url,
String? image,
int? cooking_time});
int? totalCookingTime,
int? activeCookTime,
int? servings,
int? energyPerServing});
}
/// @nodoc
@@ -75,13 +83,17 @@ class _$RecipeModelCopyWithImpl<$Res, $Val extends RecipeModel>
$Res call({
Object? ingredients = freezed,
Object? steps = freezed,
Object? tags = freezed,
Object? type = freezed,
Object? state = freezed,
Object? title = freezed,
Object? description = freezed,
Object? video_url = freezed,
Object? image = freezed,
Object? cooking_time = freezed,
Object? totalCookingTime = freezed,
Object? activeCookTime = freezed,
Object? servings = freezed,
Object? energyPerServing = freezed,
}) {
return _then(_value.copyWith(
ingredients: freezed == ingredients
@@ -92,6 +104,10 @@ class _$RecipeModelCopyWithImpl<$Res, $Val extends RecipeModel>
? _value.steps
: steps // ignore: cast_nullable_to_non_nullable
as List<Step?>?,
tags: freezed == tags
? _value.tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>?,
type: freezed == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
@@ -116,9 +132,21 @@ class _$RecipeModelCopyWithImpl<$Res, $Val extends RecipeModel>
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as String?,
cooking_time: freezed == cooking_time
? _value.cooking_time
: cooking_time // ignore: cast_nullable_to_non_nullable
totalCookingTime: freezed == totalCookingTime
? _value.totalCookingTime
: totalCookingTime // ignore: cast_nullable_to_non_nullable
as int?,
activeCookTime: freezed == activeCookTime
? _value.activeCookTime
: activeCookTime // ignore: cast_nullable_to_non_nullable
as int?,
servings: freezed == servings
? _value.servings
: servings // ignore: cast_nullable_to_non_nullable
as int?,
energyPerServing: freezed == energyPerServing
? _value.energyPerServing
: energyPerServing // ignore: cast_nullable_to_non_nullable
as int?,
) as $Val);
}
@@ -135,13 +163,17 @@ abstract class _$$RecipeModelImplCopyWith<$Res>
$Res call(
{List<Ingredient?>? ingredients,
List<Step?>? steps,
List<String>? tags,
String? type,
String? state,
String? title,
String? description,
String? video_url,
String? image,
int? cooking_time});
int? totalCookingTime,
int? activeCookTime,
int? servings,
int? energyPerServing});
}
/// @nodoc
@@ -159,13 +191,17 @@ class __$$RecipeModelImplCopyWithImpl<$Res>
$Res call({
Object? ingredients = freezed,
Object? steps = freezed,
Object? tags = freezed,
Object? type = freezed,
Object? state = freezed,
Object? title = freezed,
Object? description = freezed,
Object? video_url = freezed,
Object? image = freezed,
Object? cooking_time = freezed,
Object? totalCookingTime = freezed,
Object? activeCookTime = freezed,
Object? servings = freezed,
Object? energyPerServing = freezed,
}) {
return _then(_$RecipeModelImpl(
ingredients: freezed == ingredients
@@ -176,6 +212,10 @@ class __$$RecipeModelImplCopyWithImpl<$Res>
? _value._steps
: steps // ignore: cast_nullable_to_non_nullable
as List<Step?>?,
tags: freezed == tags
? _value._tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>?,
type: freezed == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
@@ -200,9 +240,21 @@ class __$$RecipeModelImplCopyWithImpl<$Res>
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as String?,
cooking_time: freezed == cooking_time
? _value.cooking_time
: cooking_time // ignore: cast_nullable_to_non_nullable
totalCookingTime: freezed == totalCookingTime
? _value.totalCookingTime
: totalCookingTime // ignore: cast_nullable_to_non_nullable
as int?,
activeCookTime: freezed == activeCookTime
? _value.activeCookTime
: activeCookTime // ignore: cast_nullable_to_non_nullable
as int?,
servings: freezed == servings
? _value.servings
: servings // ignore: cast_nullable_to_non_nullable
as int?,
energyPerServing: freezed == energyPerServing
? _value.energyPerServing
: energyPerServing // ignore: cast_nullable_to_non_nullable
as int?,
));
}
@@ -214,15 +266,20 @@ class _$RecipeModelImpl implements _RecipeModel {
const _$RecipeModelImpl(
{final List<Ingredient?>? ingredients,
final List<Step?>? steps,
final List<String>? tags,
this.type,
this.state,
this.title,
this.description,
this.video_url,
this.image,
this.cooking_time})
this.totalCookingTime,
this.activeCookTime,
this.servings,
this.energyPerServing})
: _ingredients = ingredients,
_steps = steps;
_steps = steps,
_tags = tags;
factory _$RecipeModelImpl.fromJson(Map<String, dynamic> json) =>
_$$RecipeModelImplFromJson(json);
@@ -247,6 +304,16 @@ class _$RecipeModelImpl implements _RecipeModel {
return EqualUnmodifiableListView(value);
}
final List<String>? _tags;
@override
List<String>? get tags {
final value = _tags;
if (value == null) return null;
if (_tags is EqualUnmodifiableListView) return _tags;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(value);
}
@override
final String? type;
@override
@@ -260,11 +327,17 @@ class _$RecipeModelImpl implements _RecipeModel {
@override
final String? image;
@override
final int? cooking_time;
final int? totalCookingTime;
@override
final int? activeCookTime;
@override
final int? servings;
@override
final int? energyPerServing;
@override
String toString() {
return 'RecipeModel(ingredients: $ingredients, steps: $steps, type: $type, state: $state, title: $title, description: $description, video_url: $video_url, image: $image, cooking_time: $cooking_time)';
return 'RecipeModel(ingredients: $ingredients, steps: $steps, tags: $tags, type: $type, state: $state, title: $title, description: $description, video_url: $video_url, image: $image, totalCookingTime: $totalCookingTime, activeCookTime: $activeCookTime, servings: $servings, energyPerServing: $energyPerServing)';
}
@override
@@ -275,6 +348,7 @@ class _$RecipeModelImpl implements _RecipeModel {
const DeepCollectionEquality()
.equals(other._ingredients, _ingredients) &&
const DeepCollectionEquality().equals(other._steps, _steps) &&
const DeepCollectionEquality().equals(other._tags, _tags) &&
(identical(other.type, type) || other.type == type) &&
(identical(other.state, state) || other.state == state) &&
(identical(other.title, title) || other.title == title) &&
@@ -283,8 +357,14 @@ class _$RecipeModelImpl implements _RecipeModel {
(identical(other.video_url, video_url) ||
other.video_url == video_url) &&
(identical(other.image, image) || other.image == image) &&
(identical(other.cooking_time, cooking_time) ||
other.cooking_time == cooking_time));
(identical(other.totalCookingTime, totalCookingTime) ||
other.totalCookingTime == totalCookingTime) &&
(identical(other.activeCookTime, activeCookTime) ||
other.activeCookTime == activeCookTime) &&
(identical(other.servings, servings) ||
other.servings == servings) &&
(identical(other.energyPerServing, energyPerServing) ||
other.energyPerServing == energyPerServing));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -293,13 +373,17 @@ class _$RecipeModelImpl implements _RecipeModel {
runtimeType,
const DeepCollectionEquality().hash(_ingredients),
const DeepCollectionEquality().hash(_steps),
const DeepCollectionEquality().hash(_tags),
type,
state,
title,
description,
video_url,
image,
cooking_time);
totalCookingTime,
activeCookTime,
servings,
energyPerServing);
/// Create a copy of RecipeModel
/// with the given fields replaced by the non-null parameter values.
@@ -321,13 +405,17 @@ abstract class _RecipeModel implements RecipeModel {
const factory _RecipeModel(
{final List<Ingredient?>? ingredients,
final List<Step?>? steps,
final List<String>? tags,
final String? type,
final String? state,
final String? title,
final String? description,
final String? video_url,
final String? image,
final int? cooking_time}) = _$RecipeModelImpl;
final int? totalCookingTime,
final int? activeCookTime,
final int? servings,
final int? energyPerServing}) = _$RecipeModelImpl;
factory _RecipeModel.fromJson(Map<String, dynamic> json) =
_$RecipeModelImpl.fromJson;
@@ -337,6 +425,8 @@ abstract class _RecipeModel implements RecipeModel {
@override
List<Step?>? get steps;
@override
List<String>? get tags;
@override
String? get type;
@override
String? get state;
@@ -349,7 +439,13 @@ abstract class _RecipeModel implements RecipeModel {
@override
String? get image;
@override
int? get cooking_time;
int? get totalCookingTime;
@override
int? get activeCookTime;
@override
int? get servings;
@override
int? get energyPerServing;
/// Create a copy of RecipeModel
/// with the given fields replaced by the non-null parameter values.

View File

@@ -16,24 +16,32 @@ _$RecipeModelImpl _$$RecipeModelImplFromJson(Map<String, dynamic> json) =>
?.map((e) =>
e == null ? null : Step.fromJson(e as Map<String, dynamic>))
.toList(),
tags: (json['tags'] as List<dynamic>?)?.map((e) => e as String).toList(),
type: json['type'] as String?,
state: json['state'] as String?,
title: json['title'] as String?,
description: json['description'] as String?,
video_url: json['video_url'] as String?,
image: json['image'] as String?,
cooking_time: (json['cooking_time'] as num?)?.toInt(),
totalCookingTime: (json['totalCookingTime'] as num?)?.toInt(),
activeCookTime: (json['activeCookTime'] as num?)?.toInt(),
servings: (json['servings'] as num?)?.toInt(),
energyPerServing: (json['energyPerServing'] as num?)?.toInt(),
);
Map<String, dynamic> _$$RecipeModelImplToJson(_$RecipeModelImpl instance) =>
<String, dynamic>{
'ingredients': instance.ingredients,
'steps': instance.steps,
'tags': instance.tags,
'type': instance.type,
'state': instance.state,
'title': instance.title,
'description': instance.description,
'video_url': instance.video_url,
'image': instance.image,
'cooking_time': instance.cooking_time,
'totalCookingTime': instance.totalCookingTime,
'activeCookTime': instance.activeCookTime,
'servings': instance.servings,
'energyPerServing': instance.energyPerServing,
};