Move data to test data folder

This commit is contained in:
Roland Geider
2021-04-15 11:05:35 +02:00
parent 2e1b1f5636
commit 9988807c25
3 changed files with 27 additions and 25 deletions

View File

@@ -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,
),

View File

@@ -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<NavigatorState>();
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<WorkoutPlans>(
create: (context) => WorkoutPlans(testAuthProvider, testExercisesProvider, [], client),
child: MaterialApp(
@@ -62,7 +42,7 @@ void main() {
home: TextButton(
onPressed: () => key.currentState!.push(
MaterialPageRoute<void>(
settings: RouteSettings(arguments: workout),
settings: RouteSettings(arguments: getWorkout()),
builder: (_) => WorkoutPlanScreen(),
),
),

View File

@@ -0,0 +1,22 @@
/*
* This file is part of wger Workout Manager <https://github.com/wger-project>.
* 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 <http://www.gnu.org/licenses/>.
*/
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));