diff --git a/test/features/my_diets/presentation/cubit/my_diets_cubit_test.dart b/test/features/my_diets/presentation/cubit/my_diets_cubit_test.dart index e5e63672..4ff33415 100644 --- a/test/features/my_diets/presentation/cubit/my_diets_cubit_test.dart +++ b/test/features/my_diets/presentation/cubit/my_diets_cubit_test.dart @@ -37,10 +37,10 @@ void main() { dailyNutrition: [], ); - final testDietsPagination = DietsPagination( + const testDietsPagination = DietsPagination( data: [testDiet], - links: const Links(first: '', last: '', prev: null, next: null), - meta: const Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), + links: Links(first: '', last: '', prev: null, next: null), + meta: Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), ); setUp(() { diff --git a/test/features/my_diets/repositories/my_diets_repository_test.dart b/test/features/my_diets/repositories/my_diets_repository_test.dart index 3454b72f..bcef377a 100644 --- a/test/features/my_diets/repositories/my_diets_repository_test.dart +++ b/test/features/my_diets/repositories/my_diets_repository_test.dart @@ -26,7 +26,7 @@ void main() { const types = 'light,veg'; const duration = 30; const sorting = 'name'; - final expected = DietsPagination( + const expected = DietsPagination( data: [ Diet( id: 1, @@ -35,10 +35,10 @@ void main() { image: 'https://someurl.com/img.jpg', duration: duration, state: DietState.active, - type: const DietType(light: true, veg: false, carb: false, meat: false), + type: DietType(light: true, veg: false, carb: false, meat: false), details: 'Test diet description', dailySchedule: {}, - author: const Author(authorSlug: '', authorName: '', authorProfileIcon: '', authorIsMe: false), + author: Author(authorSlug: '', authorName: '', authorProfileIcon: '', authorIsMe: false), totalLikes: 1, totalViews: 1, totalComments: 1, @@ -47,8 +47,8 @@ void main() { dailyNutrition: [], ), ], - links: const Links(first: '', last: '', prev: null, next: null), - meta: const Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), + links: Links(first: '', last: '', prev: null, next: null), + meta: Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), ); when(mockMyDietsService.getDiets( @@ -83,10 +83,10 @@ void main() { }); test('getDiets returns pagination with default parameters', () async { - final expected = DietsPagination( + const expected = DietsPagination( data: [], - links: const Links(first: '', last: '', prev: null, next: null), - meta: const Meta(currentPage: 1, lastPage: 1, total: 0, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), + links: Links(first: '', last: '', prev: null, next: null), + meta: Meta(currentPage: 1, lastPage: 1, total: 0, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), ); when(mockMyDietsService.getDiets( @@ -116,7 +116,7 @@ void main() { const page = 2; const query = 'wellness'; const duration = 21; - final expected = DietsPagination( + const expected = DietsPagination( data: [ Diet( id: 2, @@ -125,10 +125,10 @@ void main() { image: 'https://someurl.com/img2.jpg', duration: duration, state: DietState.draft, - type: const DietType(light: false, veg: true, carb: false, meat: false), + type: DietType(light: false, veg: true, carb: false, meat: false), details: '', dailySchedule: {}, - author: const Author(authorSlug: 'author-slug', authorName: 'Author Name', authorProfileIcon: '', authorIsMe: true), + author: Author(authorSlug: 'author-slug', authorName: 'Author Name', authorProfileIcon: '', authorIsMe: true), totalLikes: 5, totalViews: 10, totalComments: 2, @@ -137,8 +137,8 @@ void main() { dailyNutrition: [], ), ], - links: const Links(first: '', last: '', prev: null, next: null), - meta: const Meta(currentPage: 2, lastPage: 2, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), + links: Links(first: '', last: '', prev: null, next: null), + meta: Meta(currentPage: 2, lastPage: 2, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), ); when(mockMyDietsService.getDiets( diff --git a/test/features/my_diets/services/my_diets_service_test.dart b/test/features/my_diets/services/my_diets_service_test.dart index 2f7030b5..e01c8138 100644 --- a/test/features/my_diets/services/my_diets_service_test.dart +++ b/test/features/my_diets/services/my_diets_service_test.dart @@ -23,7 +23,7 @@ void main() { const types = 'light,veg'; const duration = 30; const sorting = 'name'; - final expected = DietsPagination( + const expected = DietsPagination( data: [ Diet( id: 1, @@ -32,10 +32,10 @@ void main() { image: 'https://someurl.com/img.jpg', duration: duration, state: DietState.active, - type: const DietType(light: true, veg: false, carb: false, meat: false), + type: DietType(light: true, veg: false, carb: false, meat: false), details: 'Test diet description', dailySchedule: {}, - author: const Author(authorSlug: '', authorName: '', authorProfileIcon: '', authorIsMe: false), + author: Author(authorSlug: '', authorName: '', authorProfileIcon: '', authorIsMe: false), totalLikes: 1, totalViews: 1, totalComments: 1, @@ -44,8 +44,8 @@ void main() { dailyNutrition: [], ), ], - links: const Links(first: '', last: '', prev: null, next: null), - meta: const Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), + links: Links(first: '', last: '', prev: null, next: null), + meta: Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), ); when( @@ -62,7 +62,7 @@ void main() { test('getDiets returns pagination with minimal parameters', () async { const page = 1; - final expected = DietsPagination( + const expected = DietsPagination( data: [ Diet( id: 2, @@ -71,10 +71,10 @@ void main() { image: 'https://someurl.com/img2.jpg', duration: 14, state: DietState.draft, - type: const DietType(light: false, veg: true, carb: false, meat: false), + type: DietType(light: false, veg: true, carb: false, meat: false), details: '', dailySchedule: {}, - author: const Author(authorSlug: 'author-slug', authorName: 'Author Name', authorProfileIcon: '', authorIsMe: true), + author: Author(authorSlug: 'author-slug', authorName: 'Author Name', authorProfileIcon: '', authorIsMe: true), totalLikes: 5, totalViews: 10, totalComments: 2, @@ -83,8 +83,8 @@ void main() { dailyNutrition: [], ), ], - links: const Links(first: '', last: '', prev: null, next: null), - meta: const Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), + links: Links(first: '', last: '', prev: null, next: null), + meta: Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), ); when(mockMyDietsService.getDiets(page: page, query: null, state: null, types: null, duration: null, sorting: null)).thenAnswer((_) async => expected); @@ -102,10 +102,10 @@ void main() { const query = 'wellness'; const state = 'draft'; const duration = 21; - final expected = DietsPagination( + const expected = DietsPagination( data: [], - links: const Links(first: '', last: '', prev: null, next: null), - meta: const Meta(currentPage: 2, lastPage: 2, total: 0, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), + links: Links(first: '', last: '', prev: null, next: null), + meta: Meta(currentPage: 2, lastPage: 2, total: 0, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), ); when( @@ -123,7 +123,7 @@ void main() { test('getDiets returns pagination with state filter', () async { const page = 1; const state = 'active'; - final expected = DietsPagination( + const expected = DietsPagination( data: [ Diet( id: 3, @@ -132,10 +132,10 @@ void main() { image: 'https://someurl.com/img3.jpg', duration: 7, state: DietState.active, - type: const DietType(light: true, veg: true, carb: false, meat: false), + type: DietType(light: true, veg: true, carb: false, meat: false), details: 'Active diet description', dailySchedule: {}, - author: const Author(authorSlug: 'author-2', authorName: 'Author 2', authorProfileIcon: '', authorIsMe: false), + author: Author(authorSlug: 'author-2', authorName: 'Author 2', authorProfileIcon: '', authorIsMe: false), totalLikes: 10, totalViews: 20, totalComments: 5, @@ -144,8 +144,8 @@ void main() { dailyNutrition: [], ), ], - links: const Links(first: '', last: '', prev: null, next: null), - meta: const Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), + links: Links(first: '', last: '', prev: null, next: null), + meta: Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), ); when(mockMyDietsService.getDiets(page: page, query: null, state: state, types: null, duration: null, sorting: null)).thenAnswer((_) async => expected); @@ -161,7 +161,7 @@ void main() { test('getDiets returns pagination with sorting parameter', () async { const page = 1; const sorting = 'duration'; - final expected = DietsPagination( + const expected = DietsPagination( data: [ Diet( id: 4, @@ -170,10 +170,10 @@ void main() { image: 'https://someurl.com/img4.jpg', duration: 60, state: DietState.personal, - type: const DietType(light: false, veg: false, carb: true, meat: true), + type: DietType(light: false, veg: false, carb: true, meat: true), details: 'Sorted diet description', dailySchedule: {}, - author: const Author(authorSlug: 'author-3', authorName: 'Author 3', authorProfileIcon: '', authorIsMe: false), + author: Author(authorSlug: 'author-3', authorName: 'Author 3', authorProfileIcon: '', authorIsMe: false), totalLikes: 15, totalViews: 30, totalComments: 8, @@ -182,8 +182,8 @@ void main() { dailyNutrition: [], ), ], - links: const Links(first: '', last: '', prev: null, next: null), - meta: const Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), + links: Links(first: '', last: '', prev: null, next: null), + meta: Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), ); when(mockMyDietsService.getDiets(page: page, query: null, state: null, types: null, duration: null, sorting: sorting)).thenAnswer((_) async => expected); diff --git a/test/features/my_plans/presentation/cubit/my_plans_cubit_test.dart b/test/features/my_plans/presentation/cubit/my_plans_cubit_test.dart index 215d4d6c..9e634a0d 100644 --- a/test/features/my_plans/presentation/cubit/my_plans_cubit_test.dart +++ b/test/features/my_plans/presentation/cubit/my_plans_cubit_test.dart @@ -14,17 +14,17 @@ void main() { MyPlansCubit? myPlansCubit; late MockMyPlansRepository mockMyPlansRepository; - final testPlan = PlanModel( + const testPlan = PlanModel( id: 1, slug: 'test-plan', name: 'Test Plan', image: 'https://someurl.com/img.jpg', duration: 30, state: 'active', - type: const PlanType(fit: true, slim: false, behavior: false, wellness: false), + type: PlanType(fit: true, slim: false, behavior: false, wellness: false), details: 'Test plan description', packetsCount: 1, - author: const Author(authorSlug: '', authorName: '', authorProfileIcon: '', authorIsMe: false), + author: Author(authorSlug: '', authorName: '', authorProfileIcon: '', authorIsMe: false), totalLikes: 1, totalViews: 1, totalComments: 1, @@ -34,9 +34,9 @@ void main() { wasLikedByMe: false, ); - final testPlansPagination = PlanPaginationModel( + const testPlansPagination = PlanPaginationModel( data: [testPlan], - links: const Links(first: '', last: '', prev: null, next: null), + links: Links(first: '', last: '', prev: null, next: null), meta: Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null, totalMinPrice: 100, totalMaxPrice: 500), ); diff --git a/test/features/my_plans/presentation/widgets/basic_widget_test.dart b/test/features/my_plans/presentation/widgets/basic_widget_test.dart index f79c7c58..270088f2 100644 --- a/test/features/my_plans/presentation/widgets/basic_widget_test.dart +++ b/test/features/my_plans/presentation/widgets/basic_widget_test.dart @@ -26,17 +26,17 @@ void main() { late MockMyPlansRepository mockMyPlansRepository; late MyPlansCubit myPlansCubit; - final testPlan = PlanModel( + const testPlan = PlanModel( id: 1, slug: 'test-plan', name: 'Test Plan', image: 'test-image.jpg', duration: 30, state: 'active', - type: const PlanType(fit: true, slim: false, behavior: false, wellness: false), + type: PlanType(fit: true, slim: false, behavior: false, wellness: false), details: 'Test plan description', packetsCount: 1, - author: const Author(authorSlug: '', authorName: '', authorProfileIcon: '', authorIsMe: false), + author: Author(authorSlug: '', authorName: '', authorProfileIcon: '', authorIsMe: false), totalLikes: 1, totalViews: 1, totalComments: 1, @@ -96,7 +96,7 @@ void main() { testWidgets('should display MyPlanWidget with plan name', (WidgetTester tester) async { // Arrange myPlansCubit.emit(MyPlansState(selectedStateIndex: 0)); - final widget = MyPlanWidget(plan: testPlan); + const widget = MyPlanWidget(plan: testPlan); // Act await tester.pumpWidget(createTestWidget(widget)); @@ -112,7 +112,7 @@ void main() { testWidgets('should display MyPlanWidget with description when details are present', (WidgetTester tester) async { // Arrange myPlansCubit.emit(MyPlansState(selectedStateIndex: 0)); - final widget = MyPlanWidget(plan: testPlan); + const widget = MyPlanWidget(plan: testPlan); // Act await tester.pumpWidget(createTestWidget(widget)); @@ -128,7 +128,7 @@ void main() { testWidgets('should display MyPlanWidget with price', (WidgetTester tester) async { // Arrange myPlansCubit.emit(MyPlansState(selectedStateIndex: 0)); - final widget = MyPlanWidget(plan: testPlan); + const widget = MyPlanWidget(plan: testPlan); // Act await tester.pumpWidget(createTestWidget(widget)); @@ -144,7 +144,7 @@ void main() { testWidgets('should display MyPlanWidget buttons', (WidgetTester tester) async { // Arrange myPlansCubit.emit(MyPlansState(selectedStateIndex: 0)); - final widget = MyPlanWidget(plan: testPlan); + const widget = MyPlanWidget(plan: testPlan); // Act await tester.pumpWidget(createTestWidget(widget)); @@ -160,7 +160,7 @@ void main() { testWidgets('should display MyPlanWidget structure correctly', (WidgetTester tester) async { // Arrange myPlansCubit.emit(MyPlansState(selectedStateIndex: 0)); - final widget = MyPlanWidget(plan: testPlan); + const widget = MyPlanWidget(plan: testPlan); // Act await tester.pumpWidget(createTestWidget(widget)); diff --git a/test/features/my_plans/repositories/my_plans_repository_test.dart b/test/features/my_plans/repositories/my_plans_repository_test.dart index 0f22aca8..9b15f251 100644 --- a/test/features/my_plans/repositories/my_plans_repository_test.dart +++ b/test/features/my_plans/repositories/my_plans_repository_test.dart @@ -85,7 +85,7 @@ void main() { }); test('getPlans returns pagination with default parameters', () async { - final expected = PlanPaginationModel( + const expected = PlanPaginationModel( data: [ PlanModel( id: 2, @@ -94,10 +94,10 @@ void main() { image: 'https://someurl.com/img2.jpg', duration: 14, state: 'draft', - type: const PlanType(fit: false, slim: true, behavior: false, wellness: false), + type: PlanType(fit: false, slim: true, behavior: false, wellness: false), details: '', packetsCount: 2, - author: const Author(authorSlug: 'author-slug', authorName: 'Author Name', authorProfileIcon: '', authorIsMe: true), + author: Author(authorSlug: 'author-slug', authorName: 'Author Name', authorProfileIcon: '', authorIsMe: true), totalLikes: 5, totalViews: 10, totalComments: 2, @@ -107,8 +107,8 @@ void main() { wasLikedByMe: true, ), ], - links: const Links(first: '', last: '', prev: null, next: null), - meta: const Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), + links: Links(first: '', last: '', prev: null, next: null), + meta: Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), ); when(mockMyPlansService.getPlans( @@ -139,10 +139,10 @@ void main() { const page = 2; const query = 'wellness'; const duration = 21; - final expected = PlanPaginationModel( + const expected = PlanPaginationModel( data: [], - links: const Links(first: '', last: '', prev: null, next: null), - meta: const Meta(currentPage: 2, lastPage: 2, total: 0, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), + links: Links(first: '', last: '', prev: null, next: null), + meta: Meta(currentPage: 2, lastPage: 2, total: 0, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null), ); when(mockMyPlansService.getPlans( diff --git a/test/features/recipes/presentation/cubit/my_recipes_cubit_test.dart b/test/features/recipes/presentation/cubit/my_recipes_cubit_test.dart index 1830435a..267e5191 100644 --- a/test/features/recipes/presentation/cubit/my_recipes_cubit_test.dart +++ b/test/features/recipes/presentation/cubit/my_recipes_cubit_test.dart @@ -20,7 +20,7 @@ void main() { late MockMyRecipesRepository mockMyRecipesRepository; late MockAboutRecipeRepository mockAboutRecipeRepository; - final testActiveRecipe = MyRecipeModel( + const testActiveRecipe = MyRecipeModel( id: 1, image: 'https://someurl.com/img.jpg', state: 'active', @@ -28,7 +28,7 @@ void main() { activeCookingTime: 20, description: 'Test recipe description', steps: [ - const Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1 description'), + Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1 description'), ], videoUrl: 'https://someurl.com/video.mp4', title: 'Test Recipe', @@ -38,7 +38,7 @@ void main() { viewsCount: 10, ); - final testArchivedRecipe = MyRecipeModel( + const testArchivedRecipe = MyRecipeModel( id: 2, image: 'https://someurl.com/img2.jpg', state: 'archived', diff --git a/test/features/recipes/repositories/my_recipes_repository_test.dart b/test/features/recipes/repositories/my_recipes_repository_test.dart index 5f046d32..670b90b8 100644 --- a/test/features/recipes/repositories/my_recipes_repository_test.dart +++ b/test/features/recipes/repositories/my_recipes_repository_test.dart @@ -20,7 +20,7 @@ void main() { }); test('getMyRecipes returns list of recipes', () async { - final expectedPagination = MyRecipePaginationModel( + const expectedPagination = MyRecipePaginationModel( data: [ MyRecipeModel( id: 1, @@ -30,7 +30,7 @@ void main() { activeCookingTime: 20, description: 'Test recipe description', steps: [ - const Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1 description'), + Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1 description'), ], videoUrl: 'https://someurl.com/video.mp4', title: 'Test Recipe', @@ -54,7 +54,7 @@ void main() { }); test('getMyRecipes returns empty list', () async { - final expectedPagination = MyRecipePaginationModel( + const expectedPagination = MyRecipePaginationModel( data: [], ); @@ -68,7 +68,7 @@ void main() { }); test('getMyRecipes returns multiple recipes', () async { - final expectedPagination = MyRecipePaginationModel( + const expectedPagination = MyRecipePaginationModel( data: [ MyRecipeModel( id: 1, @@ -93,7 +93,7 @@ void main() { activeCookingTime: 30, description: 'Second recipe', steps: [ - const Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1'), + Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1'), ], videoUrl: 'https://someurl.com/video.mp4', title: 'Second Recipe', diff --git a/test/features/recipes/services/my_recipes_service_test.dart b/test/features/recipes/services/my_recipes_service_test.dart index 5389cc38..b49cf222 100644 --- a/test/features/recipes/services/my_recipes_service_test.dart +++ b/test/features/recipes/services/my_recipes_service_test.dart @@ -17,7 +17,7 @@ void main() { }); test('getMyRecipes returns pagination with recipes', () async { - final expected = MyRecipePaginationModel( + const expected = MyRecipePaginationModel( data: [ MyRecipeModel( id: 1, @@ -27,8 +27,8 @@ void main() { activeCookingTime: 20, description: 'Test recipe description', steps: [ - const Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1 description'), - const Step(image: 'https://someurl.com/step2.jpg', description: 'Step 2 description'), + Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1 description'), + Step(image: 'https://someurl.com/step2.jpg', description: 'Step 2 description'), ], videoUrl: 'https://someurl.com/video.mp4', title: 'Test Recipe', @@ -52,7 +52,7 @@ void main() { }); test('getMyRecipes returns pagination with multiple recipes', () async { - final expected = MyRecipePaginationModel( + const expected = MyRecipePaginationModel( data: [ MyRecipeModel( id: 1, @@ -62,7 +62,7 @@ void main() { activeCookingTime: 20, description: 'First recipe description', steps: [ - const Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1'), + Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1'), ], videoUrl: 'https://someurl.com/video1.mp4', title: 'First Recipe', @@ -101,7 +101,7 @@ void main() { }); test('getMyRecipes returns empty pagination', () async { - final expected = MyRecipePaginationModel( + const expected = MyRecipePaginationModel( data: [], ); @@ -115,7 +115,7 @@ void main() { }); test('getMyRecipes returns recipe with null steps and videoUrl', () async { - final expected = MyRecipePaginationModel( + const expected = MyRecipePaginationModel( data: [ MyRecipeModel( id: 3,