diff --git a/test/weight_screen_test.dart b/test/weight_screen_test.dart index e8e2c489..17a4dcb9 100644 --- a/test/weight_screen_test.dart +++ b/test/weight_screen_test.dart @@ -22,13 +22,13 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:http/http.dart' as http; import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; -import 'package:wger/models/body_weight/weight_entry.dart'; import 'package:wger/providers/body_weight.dart'; import 'package:wger/screens/form_screen.dart'; import 'package:wger/screens/weight_screen.dart'; import 'package:wger/widgets/weight/charts.dart'; import 'package:wger/widgets/weight/forms.dart'; +import '../test_data/body_weight.dart'; import 'base_provider_test.mocks.dart'; import 'utils.dart'; @@ -50,8 +50,8 @@ void main() { create: (context) => BodyWeight( testAuthProvider, [ - WeightEntry(id: 1, weight: 80, date: DateTime(2021, 01, 01)), - WeightEntry(id: 2, weight: 81, date: DateTime(2021, 01, 10)), + weightEntry1, + weightEntry2, ], client, ), diff --git a/test/workout_plan_screen_test.dart b/test/workout_plan_screen_test.dart index f57d24a2..cc2aba37 100644 --- a/test/workout_plan_screen_test.dart +++ b/test/workout_plan_screen_test.dart @@ -20,11 +20,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:provider/provider.dart'; -import 'package:wger/models/workouts/day.dart'; -import 'package:wger/models/workouts/workout_plan.dart'; import 'package:wger/providers/workout_plans.dart'; import 'package:wger/screens/workout_plan_screen.dart'; +import '../test_data/workouts.dart'; import 'base_provider_test.mocks.dart'; import 'utils.dart'; @@ -33,25 +32,6 @@ void main() { final key = GlobalKey(); final client = MockClient(); - var day = Day() - ..id = 1 - ..workoutId = 1 - ..description = 'test day 1' - ..daysOfWeek = [1, 2]; - - var day2 = Day() - ..id = 2 - ..workoutId = 1 - ..description = 'test day 2' - ..daysOfWeek = [4]; - - WorkoutPlan workout = WorkoutPlan( - id: 1, - creationDate: DateTime(2021, 01, 01), - description: 'test workout 1', - days: [day, day2], - ); - return ChangeNotifierProvider( create: (context) => WorkoutPlans(testAuthProvider, testExercisesProvider, [], client), child: MaterialApp( @@ -62,7 +42,7 @@ void main() { home: TextButton( onPressed: () => key.currentState!.push( MaterialPageRoute( - settings: RouteSettings(arguments: workout), + settings: RouteSettings(arguments: getWorkout()), builder: (_) => WorkoutPlanScreen(), ), ), diff --git a/test_data/body_weight.dart b/test_data/body_weight.dart new file mode 100644 index 00000000..409a1abd --- /dev/null +++ b/test_data/body_weight.dart @@ -0,0 +1,22 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wger Workout Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:wger/models/body_weight/weight_entry.dart'; + +final weightEntry1 = WeightEntry(id: 1, weight: 80, date: DateTime(2021, 01, 01)); +final weightEntry2 = WeightEntry(id: 2, weight: 81, date: DateTime(2021, 01, 10));