forked from eatvio/eatvio_app
feat(dependencies): add rxdart package and improve string extension methods for better handling of empty strings and gender parsing
This commit is contained in:
55
test/features/recipe/models/my_recipe_model_test.dart
Normal file
55
test/features/recipe/models/my_recipe_model_test.dart
Normal file
@@ -0,0 +1,55 @@
|
||||
import 'package:eatvio_app/features/recipe/models/my_recipe_model.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('MyRecipeModel', () {
|
||||
test('создает MyRecipeModel с правильными значениями', () {
|
||||
const model = MyRecipeModel(
|
||||
id: 1,
|
||||
image: 'https://example.com/image.jpg',
|
||||
state: 'active',
|
||||
cookingTime: 30,
|
||||
activeCookingTime: 15,
|
||||
description: 'Test description',
|
||||
steps: null,
|
||||
videoUrl: null,
|
||||
title: 'Test Recipe',
|
||||
slug: 'test-recipe',
|
||||
calories: 300.0,
|
||||
likesCount: 10,
|
||||
viewsCount: 100,
|
||||
);
|
||||
|
||||
expect(model.id, 1);
|
||||
expect(model.title, 'Test Recipe');
|
||||
expect(model.slug, 'test-recipe');
|
||||
expect(model.calories, 300.0);
|
||||
});
|
||||
});
|
||||
|
||||
group('MyRecipePaginationModel', () {
|
||||
test('создает MyRecipePaginationModel с правильными значениями', () {
|
||||
const recipe = MyRecipeModel(
|
||||
id: 1,
|
||||
image: 'https://example.com/image.jpg',
|
||||
state: 'active',
|
||||
cookingTime: 30,
|
||||
activeCookingTime: 15,
|
||||
description: 'Test description',
|
||||
steps: null,
|
||||
videoUrl: null,
|
||||
title: 'Test Recipe',
|
||||
slug: 'test-recipe',
|
||||
calories: 300.0,
|
||||
likesCount: 10,
|
||||
viewsCount: 100,
|
||||
);
|
||||
|
||||
const pagination = MyRecipePaginationModel(data: [recipe]);
|
||||
|
||||
expect(pagination.data.length, 1);
|
||||
expect(pagination.data.first.id, 1);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/recipes_model.dart';
|
||||
import 'package:eatvio_app/features/recipe/presentation/cubit/about_recipe_cubit.dart';
|
||||
import 'package:eatvio_app/features/recipe/presentation/cubit/about_recipe_state.dart';
|
||||
import 'package:eatvio_app/features/recipe/repositories/about_recipe_repository.dart';
|
||||
import 'package:eatvio_app/features/profile/repositories/profile_repository.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
|
||||
import 'about_recipe_cubit_test.mocks.dart';
|
||||
|
||||
@GenerateNiceMocks([
|
||||
MockSpec<AboutRecipeRepository>(),
|
||||
MockSpec<ProfileRepository>(),
|
||||
])
|
||||
void main() {
|
||||
group('AboutRecipeCubit', () {
|
||||
AboutRecipeCubit? aboutRecipeCubit;
|
||||
late MockAboutRecipeRepository mockRecipeRepository;
|
||||
late MockProfileRepository mockProfileRepository;
|
||||
|
||||
setUp(() {
|
||||
mockRecipeRepository = MockAboutRecipeRepository();
|
||||
mockProfileRepository = MockProfileRepository();
|
||||
});
|
||||
|
||||
tearDown(() async {
|
||||
if (aboutRecipeCubit != null && !aboutRecipeCubit!.isClosed) {
|
||||
await aboutRecipeCubit!.close();
|
||||
aboutRecipeCubit = null;
|
||||
}
|
||||
});
|
||||
|
||||
test('начальное состояние - initial', () {
|
||||
aboutRecipeCubit = AboutRecipeCubit(
|
||||
recipeRepository: mockRecipeRepository,
|
||||
profileRepository: mockProfileRepository,
|
||||
);
|
||||
|
||||
expect(aboutRecipeCubit!.state, isA<AboutRecipeState>());
|
||||
});
|
||||
|
||||
test('getRecipe - успешная загрузка рецепта', () async {
|
||||
aboutRecipeCubit = AboutRecipeCubit(
|
||||
recipeRepository: mockRecipeRepository,
|
||||
profileRepository: mockProfileRepository,
|
||||
);
|
||||
|
||||
const testRecipe = Recipe(
|
||||
id: 1,
|
||||
image: 'https://example.com/image.jpg',
|
||||
state: 'active',
|
||||
cookingTime: 30,
|
||||
activeCookingTime: 15,
|
||||
ingredients: [],
|
||||
description: 'Test description',
|
||||
steps: [],
|
||||
videoUrl: null,
|
||||
createdAt: null,
|
||||
updatedAt: null,
|
||||
title: 'Test Recipe',
|
||||
type: 'main',
|
||||
slug: 'test-recipe',
|
||||
commentsCount: 5,
|
||||
wasLikedByMe: false,
|
||||
isFavorite: false,
|
||||
calories: 300.0,
|
||||
servings: 4,
|
||||
likesCount: 10,
|
||||
viewsCount: 100,
|
||||
tags: [],
|
||||
author: Author(
|
||||
authorSlug: 'author',
|
||||
authorName: 'Author Name',
|
||||
authorProfileIcon: 'https://example.com/icon.jpg',
|
||||
authorIsMe: false,
|
||||
isEntitySubscribedByMe: null,
|
||||
authorPlaceInRating: null,
|
||||
),
|
||||
);
|
||||
|
||||
when(mockRecipeRepository.getRecipe('1'))
|
||||
.thenAnswer((_) async => testRecipe);
|
||||
|
||||
await aboutRecipeCubit!.getRecipe('1');
|
||||
|
||||
expect(aboutRecipeCubit!.state, isA<AboutRecipeStateLoaded>());
|
||||
final loadedState = aboutRecipeCubit!.state as AboutRecipeStateLoaded;
|
||||
expect(loadedState.recipe.id, 1);
|
||||
});
|
||||
|
||||
test('getRecipe - обработка ошибки', () async {
|
||||
aboutRecipeCubit = AboutRecipeCubit(
|
||||
recipeRepository: mockRecipeRepository,
|
||||
profileRepository: mockProfileRepository,
|
||||
);
|
||||
|
||||
when(mockRecipeRepository.getRecipe(any))
|
||||
.thenThrow(Exception('Ошибка загрузки'));
|
||||
|
||||
await aboutRecipeCubit!.getRecipe('1');
|
||||
|
||||
expect(aboutRecipeCubit!.state, isA<RecipeStateError>());
|
||||
final errorState = aboutRecipeCubit!.state as RecipeStateError;
|
||||
expect(errorState.message, isNotEmpty);
|
||||
});
|
||||
|
||||
test('likeRecipe - лайк рецепта', () async {
|
||||
aboutRecipeCubit = AboutRecipeCubit(
|
||||
recipeRepository: mockRecipeRepository,
|
||||
profileRepository: mockProfileRepository,
|
||||
);
|
||||
|
||||
const testRecipe = Recipe(
|
||||
id: 1,
|
||||
image: 'https://example.com/image.jpg',
|
||||
state: 'active',
|
||||
cookingTime: 30,
|
||||
activeCookingTime: 15,
|
||||
ingredients: [],
|
||||
description: 'Test description',
|
||||
steps: [],
|
||||
videoUrl: null,
|
||||
createdAt: null,
|
||||
updatedAt: null,
|
||||
title: 'Test Recipe',
|
||||
type: 'main',
|
||||
slug: 'test-recipe',
|
||||
commentsCount: 5,
|
||||
wasLikedByMe: false,
|
||||
isFavorite: false,
|
||||
calories: 300.0,
|
||||
servings: 4,
|
||||
likesCount: 10,
|
||||
viewsCount: 100,
|
||||
tags: [],
|
||||
author: Author(
|
||||
authorSlug: 'author',
|
||||
authorName: 'Author Name',
|
||||
authorProfileIcon: 'https://example.com/icon.jpg',
|
||||
authorIsMe: false,
|
||||
isEntitySubscribedByMe: null,
|
||||
authorPlaceInRating: null,
|
||||
),
|
||||
);
|
||||
|
||||
when(mockRecipeRepository.getRecipe('1'))
|
||||
.thenAnswer((_) async => testRecipe);
|
||||
when(mockRecipeRepository.likeRecipe('1'))
|
||||
.thenAnswer((_) async => {});
|
||||
|
||||
await aboutRecipeCubit!.getRecipe('1');
|
||||
await aboutRecipeCubit!.likeRecipe('1', null);
|
||||
|
||||
await Future.delayed(const Duration(milliseconds: 1200));
|
||||
expect(aboutRecipeCubit!.state, isA<AboutRecipeStateLoaded>());
|
||||
final loadedState = aboutRecipeCubit!.state as AboutRecipeStateLoaded;
|
||||
expect(loadedState.recipe.wasLikedByMe, isTrue);
|
||||
expect(loadedState.recipe.likesCount, 11);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
import 'package:eatvio_app/features/recipe/models/my_recipe_model.dart';
|
||||
import 'package:eatvio_app/features/recipe/presentation/cubit/my_recipes_cubit/my_recieps_cubit.dart';
|
||||
import 'package:eatvio_app/features/recipe/presentation/cubit/my_recipes_cubit/my_recipes_state.dart';
|
||||
import 'package:eatvio_app/features/recipe/repositories/about_recipe_repository.dart';
|
||||
import 'package:eatvio_app/features/recipe/repositories/my_recipes_repository.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
|
||||
import 'my_recipes_cubit_test.mocks.dart';
|
||||
|
||||
@GenerateNiceMocks([
|
||||
MockSpec<MyRecipesRepository>(),
|
||||
MockSpec<AboutRecipeRepository>(),
|
||||
])
|
||||
void main() {
|
||||
group('MyRecipesCubit', () {
|
||||
MyRecipesCubit? cubit;
|
||||
late MockMyRecipesRepository mockMyRecipesRepository;
|
||||
late MockAboutRecipeRepository mockAboutRecipeRepository;
|
||||
|
||||
setUp(() {
|
||||
mockMyRecipesRepository = MockMyRecipesRepository();
|
||||
mockAboutRecipeRepository = MockAboutRecipeRepository();
|
||||
});
|
||||
|
||||
tearDown(() async {
|
||||
if (cubit != null && !cubit!.isClosed) {
|
||||
await cubit!.close();
|
||||
cubit = null;
|
||||
}
|
||||
});
|
||||
|
||||
test('начальное состояние - loading', () {
|
||||
cubit = MyRecipesCubit(
|
||||
myRecipesRepository: mockMyRecipesRepository,
|
||||
aboutRecipeRepository: mockAboutRecipeRepository,
|
||||
);
|
||||
|
||||
expect(cubit!.state, isA<MyRecipesStateLoading>());
|
||||
});
|
||||
|
||||
test('getMyRecipes - успешная загрузка активных рецептов', () async {
|
||||
cubit = MyRecipesCubit(
|
||||
myRecipesRepository: mockMyRecipesRepository,
|
||||
aboutRecipeRepository: mockAboutRecipeRepository,
|
||||
);
|
||||
|
||||
final testRecipes = [
|
||||
const MyRecipeModel(
|
||||
id: 1,
|
||||
slug: 'test-recipe',
|
||||
image: 'https://example.com/image.jpg',
|
||||
state: 'active',
|
||||
cookingTime: 30,
|
||||
activeCookingTime: 15,
|
||||
description: 'Test description',
|
||||
steps: [],
|
||||
videoUrl: null,
|
||||
title: 'Test Recipe',
|
||||
calories: 300.0,
|
||||
likesCount: 10,
|
||||
viewsCount: 100,
|
||||
),
|
||||
];
|
||||
|
||||
when(mockMyRecipesRepository.getMyRecipes())
|
||||
.thenAnswer((_) async => testRecipes);
|
||||
|
||||
await cubit!.getMyRecipes();
|
||||
|
||||
expect(cubit!.state, isA<MyRecipesStateLoaded>());
|
||||
final loadedState = cubit!.state as MyRecipesStateLoaded;
|
||||
expect(loadedState.recipes.length, 1);
|
||||
expect(loadedState.selectedState, 'active');
|
||||
});
|
||||
|
||||
test('setActiveState - фильтрует активные рецепты', () async {
|
||||
cubit = MyRecipesCubit(
|
||||
myRecipesRepository: mockMyRecipesRepository,
|
||||
aboutRecipeRepository: mockAboutRecipeRepository,
|
||||
);
|
||||
|
||||
final testRecipes = [
|
||||
const MyRecipeModel(
|
||||
id: 1,
|
||||
slug: 'test-recipe-1',
|
||||
image: 'https://example.com/image1.jpg',
|
||||
state: 'active',
|
||||
cookingTime: 30,
|
||||
activeCookingTime: 15,
|
||||
description: 'Test description 1',
|
||||
steps: [],
|
||||
videoUrl: null,
|
||||
title: 'Test Recipe 1',
|
||||
calories: 300.0,
|
||||
likesCount: 10,
|
||||
viewsCount: 100,
|
||||
),
|
||||
const MyRecipeModel(
|
||||
id: 2,
|
||||
slug: 'test-recipe-2',
|
||||
image: 'https://example.com/image2.jpg',
|
||||
state: 'archived',
|
||||
cookingTime: 45,
|
||||
activeCookingTime: 20,
|
||||
description: 'Test description 2',
|
||||
steps: [],
|
||||
videoUrl: null,
|
||||
title: 'Test Recipe 2',
|
||||
calories: 400.0,
|
||||
likesCount: 20,
|
||||
viewsCount: 200,
|
||||
),
|
||||
];
|
||||
|
||||
when(mockMyRecipesRepository.getMyRecipes())
|
||||
.thenAnswer((_) async => testRecipes);
|
||||
|
||||
await cubit!.setActiveState();
|
||||
|
||||
expect(cubit!.state, isA<MyRecipesStateLoaded>());
|
||||
final loadedState = cubit!.state as MyRecipesStateLoaded;
|
||||
expect(loadedState.recipes.length, 1);
|
||||
expect(loadedState.recipes.first.state, 'active');
|
||||
});
|
||||
|
||||
test('setArchivedState - фильтрует архивированные рецепты', () async {
|
||||
cubit = MyRecipesCubit(
|
||||
myRecipesRepository: mockMyRecipesRepository,
|
||||
aboutRecipeRepository: mockAboutRecipeRepository,
|
||||
);
|
||||
|
||||
final testRecipes = [
|
||||
const MyRecipeModel(
|
||||
id: 1,
|
||||
slug: 'test-recipe-1',
|
||||
image: 'https://example.com/image1.jpg',
|
||||
state: 'active',
|
||||
cookingTime: 30,
|
||||
activeCookingTime: 15,
|
||||
description: 'Test description 1',
|
||||
steps: [],
|
||||
videoUrl: null,
|
||||
title: 'Test Recipe 1',
|
||||
calories: 300.0,
|
||||
likesCount: 10,
|
||||
viewsCount: 100,
|
||||
),
|
||||
const MyRecipeModel(
|
||||
id: 2,
|
||||
slug: 'test-recipe-2',
|
||||
image: 'https://example.com/image2.jpg',
|
||||
state: 'archived',
|
||||
cookingTime: 45,
|
||||
activeCookingTime: 20,
|
||||
description: 'Test description 2',
|
||||
steps: [],
|
||||
videoUrl: null,
|
||||
title: 'Test Recipe 2',
|
||||
calories: 400.0,
|
||||
likesCount: 20,
|
||||
viewsCount: 200,
|
||||
),
|
||||
];
|
||||
|
||||
when(mockMyRecipesRepository.getMyRecipes())
|
||||
.thenAnswer((_) async => testRecipes);
|
||||
|
||||
await cubit!.setArchivedState();
|
||||
|
||||
expect(cubit!.state, isA<MyRecipesStateLoaded>());
|
||||
final loadedState = cubit!.state as MyRecipesStateLoaded;
|
||||
expect(loadedState.recipes.length, 1);
|
||||
expect(loadedState.recipes.first.state, 'archived');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
import 'package:eatvio_app/features/diets/repositories/diet_repository.dart';
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/recipes_model.dart';
|
||||
import 'package:eatvio_app/features/recipe/repositories/about_recipe_repository.dart';
|
||||
import 'package:eatvio_app/features/recipe/services/about_recipe_service.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
|
||||
import 'about_recipe_repository_test.mocks.dart';
|
||||
|
||||
@GenerateNiceMocks([MockSpec<AboutRecipeService>()])
|
||||
void main() {
|
||||
group('AboutRecipeRepository', () {
|
||||
late AboutRecipeRepository repository;
|
||||
late MockAboutRecipeService mockService;
|
||||
|
||||
setUp(() {
|
||||
mockService = MockAboutRecipeService();
|
||||
repository = AboutRecipeRepository(recipeService: mockService);
|
||||
});
|
||||
|
||||
test('getRecipe - успешное получение рецепта', () async {
|
||||
const recipeId = 'recipe-1';
|
||||
const expectedRecipe = Recipe(
|
||||
id: 1,
|
||||
image: 'https://example.com/image.jpg',
|
||||
state: 'active',
|
||||
cookingTime: 30,
|
||||
activeCookingTime: 15,
|
||||
ingredients: [],
|
||||
description: 'Test description',
|
||||
steps: [],
|
||||
videoUrl: null,
|
||||
createdAt: null,
|
||||
updatedAt: null,
|
||||
title: 'Test Recipe',
|
||||
type: 'main',
|
||||
slug: 'test-recipe',
|
||||
commentsCount: 5,
|
||||
wasLikedByMe: false,
|
||||
isFavorite: false,
|
||||
calories: 300.0,
|
||||
servings: 4,
|
||||
likesCount: 10,
|
||||
viewsCount: 100,
|
||||
tags: [],
|
||||
author: Author(
|
||||
authorSlug: 'author',
|
||||
authorName: 'Author Name',
|
||||
authorProfileIcon: 'https://example.com/icon.jpg',
|
||||
authorIsMe: false,
|
||||
isEntitySubscribedByMe: null,
|
||||
authorPlaceInRating: null,
|
||||
),
|
||||
);
|
||||
|
||||
when(mockService.getRecipe(recipeId))
|
||||
.thenAnswer((_) async => expectedRecipe);
|
||||
|
||||
final result = await repository.getRecipe(recipeId);
|
||||
|
||||
expect(result, equals(expectedRecipe));
|
||||
expect(result.id, 1);
|
||||
verify(mockService.getRecipe(recipeId)).called(1);
|
||||
});
|
||||
|
||||
test('likeRecipe - успешный лайк', () async {
|
||||
const slug = 'test-recipe';
|
||||
|
||||
when(mockService.likeRecipe(slug: slug))
|
||||
.thenAnswer((_) async => Future.value());
|
||||
|
||||
await repository.likeRecipe(slug);
|
||||
|
||||
verify(mockService.likeRecipe(slug: slug)).called(1);
|
||||
});
|
||||
|
||||
test('addToFavorite - успешное добавление в избранное', () async {
|
||||
const slug = 'test-recipe';
|
||||
|
||||
when(mockService.addToFavorite(slug: slug))
|
||||
.thenAnswer((_) async => Future.value());
|
||||
|
||||
await repository.addToFavorite(slug);
|
||||
|
||||
verify(mockService.addToFavorite(slug: slug)).called(1);
|
||||
});
|
||||
|
||||
test('removeFromFavorite - успешное удаление из избранного', () async {
|
||||
const slug = 'test-recipe';
|
||||
|
||||
when(mockService.removeFromFavorite(slug: slug))
|
||||
.thenAnswer((_) async => Future.value());
|
||||
|
||||
await repository.removeFromFavorite(slug);
|
||||
|
||||
verify(mockService.removeFromFavorite(slug: slug)).called(1);
|
||||
});
|
||||
|
||||
test('deleteRecipe - успешное удаление рецепта', () async {
|
||||
const slug = 'test-recipe';
|
||||
|
||||
when(mockService.deleteRecipe(slug: slug))
|
||||
.thenAnswer((_) async => Future.value());
|
||||
|
||||
await repository.deleteRecipe(slug);
|
||||
|
||||
verify(mockService.deleteRecipe(slug: slug)).called(1);
|
||||
});
|
||||
|
||||
test('emitLikesStateToFeed - отправляет состояние лайков', () async {
|
||||
const state = LikesState(
|
||||
wasLikedByMe: true,
|
||||
totalLikes: 10,
|
||||
index: 0,
|
||||
);
|
||||
|
||||
expectLater(repository.recipeLikeState, emits(state));
|
||||
repository.emitLikesStateToFeed(state);
|
||||
});
|
||||
|
||||
test('emitFavoriteStateToFeed - отправляет состояние избранного', () async {
|
||||
const state = FavoriteState(
|
||||
isFavorite: true,
|
||||
index: 0,
|
||||
);
|
||||
|
||||
expectLater(repository.recipeFavoriteState, emits(state));
|
||||
repository.emitFavoriteStateToFeed(state);
|
||||
});
|
||||
|
||||
test('emitCommentsStateToFeed - отправляет состояние комментариев', () async {
|
||||
const state = CommentsState(
|
||||
index: 0,
|
||||
totalComments: 5,
|
||||
);
|
||||
|
||||
expectLater(repository.recipeCommentsState, emits(state));
|
||||
repository.emitCommentsStateToFeed(state);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
import 'package:eatvio_app/features/recipe/models/my_recipe_model.dart';
|
||||
import 'package:eatvio_app/features/recipe/repositories/my_recipes_repository.dart';
|
||||
import 'package:eatvio_app/features/recipe/services/my_recipes_service.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
|
||||
import 'my_recipes_repository_test.mocks.dart';
|
||||
|
||||
@GenerateNiceMocks([MockSpec<MyRecipesService>()])
|
||||
void main() {
|
||||
group('MyRecipesRepository', () {
|
||||
late MyRecipesRepository repository;
|
||||
late MockMyRecipesService mockService;
|
||||
|
||||
setUp(() {
|
||||
mockService = MockMyRecipesService();
|
||||
repository = MyRecipesRepository(myRecipesService: mockService);
|
||||
});
|
||||
|
||||
test('getMyRecipes - успешное получение рецептов', () async {
|
||||
final expectedRecipes = [
|
||||
const MyRecipeModel(
|
||||
id: 1,
|
||||
image: 'https://example.com/image.jpg',
|
||||
state: 'active',
|
||||
cookingTime: 30,
|
||||
activeCookingTime: 15,
|
||||
description: 'Test description',
|
||||
steps: null,
|
||||
videoUrl: null,
|
||||
title: 'Test Recipe',
|
||||
slug: 'test-recipe',
|
||||
calories: 300.0,
|
||||
likesCount: 10,
|
||||
viewsCount: 100,
|
||||
),
|
||||
];
|
||||
|
||||
final paginationModel = MyRecipePaginationModel(data: expectedRecipes);
|
||||
|
||||
when(mockService.getMyRecipes())
|
||||
.thenAnswer((_) async => paginationModel);
|
||||
|
||||
final result = await repository.getMyRecipes();
|
||||
|
||||
expect(result, equals(expectedRecipes));
|
||||
expect(result.length, 1);
|
||||
expect(result.first.id, 1);
|
||||
verify(mockService.getMyRecipes()).called(1);
|
||||
});
|
||||
|
||||
test('getMyRecipes - пробрасывает исключение', () async {
|
||||
when(mockService.getMyRecipes())
|
||||
.thenThrow(Exception('Ошибка получения рецептов'));
|
||||
|
||||
expect(
|
||||
() => repository.getMyRecipes(),
|
||||
throwsException,
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user