mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 23:42:00 +01:00
Fix some tests
This commit is contained in:
@@ -170,14 +170,12 @@ class MainApp extends StatelessWidget {
|
||||
ChangeNotifierProxyProvider<AuthProvider, RoutinesProvider>(
|
||||
create: (context) => RoutinesProvider(
|
||||
WgerBaseProvider(Provider.of(context, listen: false)),
|
||||
[],
|
||||
exercises: [],
|
||||
),
|
||||
update: (context, auth, previous) =>
|
||||
previous ??
|
||||
RoutinesProvider(
|
||||
WgerBaseProvider(auth),
|
||||
[],
|
||||
exercises: [],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -81,13 +81,13 @@ class RoutinesProvider with ChangeNotifier {
|
||||
List<RepetitionUnit> _repetitionUnits = [];
|
||||
|
||||
RoutinesProvider(
|
||||
this.baseProvider,
|
||||
List<Routine> entries, {
|
||||
this.baseProvider, {
|
||||
List<Routine>? entries,
|
||||
List<WeightUnit>? weightUnits,
|
||||
List<RepetitionUnit>? repetitionUnits,
|
||||
List<Exercise>? exercises,
|
||||
}) {
|
||||
_routines = entries;
|
||||
_routines = entries ?? [];
|
||||
_weightUnits = weightUnits ?? [];
|
||||
_repetitionUnits = repetitionUnits ?? [];
|
||||
_exercises = exercises ?? [];
|
||||
@@ -305,6 +305,7 @@ class RoutinesProvider with ChangeNotifier {
|
||||
for (final slotEntry in slot.entries) {
|
||||
final exerciseId = slotEntry.exerciseId;
|
||||
if (!exercises.containsKey(exerciseId)) {
|
||||
print(exerciseId);
|
||||
exercises[exerciseId] = _getExerciseById(exerciseId);
|
||||
}
|
||||
slotEntry.exerciseObj = exercises[exerciseId]!;
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
"comment": "",
|
||||
"is_superset": false,
|
||||
"exercises": [
|
||||
76
|
||||
4
|
||||
],
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 4,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -90,7 +90,7 @@
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 4,
|
||||
"max_sets": null,
|
||||
"weight": "20.00",
|
||||
@@ -169,12 +169,12 @@
|
||||
"comment": "",
|
||||
"is_superset": false,
|
||||
"exercises": [
|
||||
76
|
||||
4
|
||||
],
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 4,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -240,7 +240,7 @@
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 4,
|
||||
"max_sets": null,
|
||||
"weight": "21.00",
|
||||
@@ -312,12 +312,12 @@
|
||||
"comment": "",
|
||||
"is_superset": false,
|
||||
"exercises": [
|
||||
76
|
||||
4
|
||||
],
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 4,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -383,7 +383,7 @@
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 4,
|
||||
"max_sets": null,
|
||||
"weight": "22.00",
|
||||
@@ -455,12 +455,12 @@
|
||||
"comment": "",
|
||||
"is_superset": false,
|
||||
"exercises": [
|
||||
76
|
||||
4
|
||||
],
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 4,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -521,12 +521,12 @@
|
||||
"comment": "",
|
||||
"is_superset": false,
|
||||
"exercises": [
|
||||
92
|
||||
6
|
||||
],
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 4,
|
||||
"max_sets": null,
|
||||
"weight": "23.00",
|
||||
@@ -598,12 +598,12 @@
|
||||
"comment": "",
|
||||
"is_superset": false,
|
||||
"exercises": [
|
||||
76
|
||||
4
|
||||
],
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 4,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -669,7 +669,7 @@
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 4,
|
||||
"max_sets": null,
|
||||
"weight": "24.00",
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
"comment": "",
|
||||
"is_superset": false,
|
||||
"exercises": [
|
||||
76
|
||||
4
|
||||
],
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -46,7 +46,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -68,7 +68,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -90,7 +90,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -151,12 +151,12 @@
|
||||
"comment": "",
|
||||
"is_superset": false,
|
||||
"exercises": [
|
||||
92
|
||||
6
|
||||
],
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "20.00",
|
||||
@@ -178,7 +178,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "20.00",
|
||||
@@ -200,7 +200,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "20.00",
|
||||
@@ -222,7 +222,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "20.00",
|
||||
@@ -301,12 +301,12 @@
|
||||
"comment": "",
|
||||
"is_superset": false,
|
||||
"exercises": [
|
||||
76
|
||||
4
|
||||
],
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -328,7 +328,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -350,7 +350,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -372,7 +372,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -433,12 +433,12 @@
|
||||
"comment": "",
|
||||
"is_superset": false,
|
||||
"exercises": [
|
||||
92
|
||||
6
|
||||
],
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "21.00",
|
||||
@@ -460,7 +460,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "21.00",
|
||||
@@ -482,7 +482,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "21.00",
|
||||
@@ -504,7 +504,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "21.00",
|
||||
@@ -576,12 +576,12 @@
|
||||
"comment": "",
|
||||
"is_superset": false,
|
||||
"exercises": [
|
||||
76
|
||||
4
|
||||
],
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -603,7 +603,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -625,7 +625,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -647,7 +647,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -708,12 +708,12 @@
|
||||
"comment": "",
|
||||
"is_superset": false,
|
||||
"exercises": [
|
||||
92
|
||||
6
|
||||
],
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "22.00",
|
||||
@@ -735,7 +735,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "22.00",
|
||||
@@ -757,7 +757,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "22.00",
|
||||
@@ -779,7 +779,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "22.00",
|
||||
@@ -851,12 +851,12 @@
|
||||
"comment": "",
|
||||
"is_superset": false,
|
||||
"exercises": [
|
||||
76
|
||||
4
|
||||
],
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -878,7 +878,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -900,7 +900,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -922,7 +922,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -983,12 +983,12 @@
|
||||
"comment": "",
|
||||
"is_superset": false,
|
||||
"exercises": [
|
||||
92
|
||||
6
|
||||
],
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "23.00",
|
||||
@@ -1010,7 +1010,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "23.00",
|
||||
@@ -1032,7 +1032,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "23.00",
|
||||
@@ -1054,7 +1054,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "23.00",
|
||||
@@ -1126,12 +1126,12 @@
|
||||
"comment": "",
|
||||
"is_superset": false,
|
||||
"exercises": [
|
||||
76
|
||||
4
|
||||
],
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -1153,7 +1153,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -1175,7 +1175,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -1197,7 +1197,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "80.00",
|
||||
@@ -1258,12 +1258,12 @@
|
||||
"comment": "",
|
||||
"is_superset": false,
|
||||
"exercises": [
|
||||
92
|
||||
6
|
||||
],
|
||||
"sets": [
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "24.00",
|
||||
@@ -1285,7 +1285,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "24.00",
|
||||
@@ -1307,7 +1307,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "24.00",
|
||||
@@ -1329,7 +1329,7 @@
|
||||
},
|
||||
{
|
||||
"slot_entry_id": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"sets": 1,
|
||||
"max_sets": null,
|
||||
"weight": "24.00",
|
||||
|
||||
27
test/fixtures/routines/routine_logs.json
vendored
27
test/fixtures/routines/routine_logs.json
vendored
@@ -2,6 +2,7 @@
|
||||
{
|
||||
"session": {
|
||||
"id": 5,
|
||||
"uuid": "3291b27b-1973-455d-896c-57e705373e6c",
|
||||
"routine": 2,
|
||||
"day": null,
|
||||
"date": "2025-01-06",
|
||||
@@ -19,7 +20,7 @@
|
||||
"iteration": 1,
|
||||
"slot_entry": 2,
|
||||
"next_log": null,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"repetitions_unit": 1,
|
||||
"repetitions": "11.00",
|
||||
"repetitions_target": "10.00",
|
||||
@@ -39,7 +40,7 @@
|
||||
"iteration": 1,
|
||||
"slot_entry": 2,
|
||||
"next_log": null,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"repetitions_unit": 1,
|
||||
"repetitions": "12.00",
|
||||
"repetitions_target": "10.00",
|
||||
@@ -59,7 +60,7 @@
|
||||
"iteration": 1,
|
||||
"slot_entry": 2,
|
||||
"next_log": null,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"repetitions_unit": 1,
|
||||
"repetitions": "12.00",
|
||||
"repetitions_target": "10.00",
|
||||
@@ -79,7 +80,7 @@
|
||||
"iteration": 1,
|
||||
"slot_entry": 2,
|
||||
"next_log": null,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"repetitions_unit": 1,
|
||||
"repetitions": "12.00",
|
||||
"repetitions_target": "10.00",
|
||||
@@ -96,6 +97,7 @@
|
||||
{
|
||||
"session": {
|
||||
"id": 6,
|
||||
"uuid":"7e3d2a44-1a99-46d7-a58c-955f5fee8145",
|
||||
"routine": 2,
|
||||
"day": null,
|
||||
"date": "2025-01-08",
|
||||
@@ -113,7 +115,7 @@
|
||||
"iteration": 1,
|
||||
"slot_entry": 3,
|
||||
"next_log": null,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"repetitions_unit": 1,
|
||||
"repetitions": "10.00",
|
||||
"repetitions_target": "10.00",
|
||||
@@ -133,7 +135,7 @@
|
||||
"iteration": 1,
|
||||
"slot_entry": 3,
|
||||
"next_log": null,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"repetitions_unit": 1,
|
||||
"repetitions": "11.00",
|
||||
"repetitions_target": "10.00",
|
||||
@@ -153,7 +155,7 @@
|
||||
"iteration": 1,
|
||||
"slot_entry": 3,
|
||||
"next_log": null,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"repetitions_unit": 1,
|
||||
"repetitions": "11.00",
|
||||
"repetitions_target": "10.00",
|
||||
@@ -173,7 +175,7 @@
|
||||
"iteration": 1,
|
||||
"slot_entry": 3,
|
||||
"next_log": null,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"repetitions_unit": 1,
|
||||
"repetitions": "12.00",
|
||||
"repetitions_target": "10.00",
|
||||
@@ -190,6 +192,7 @@
|
||||
{
|
||||
"session": {
|
||||
"id": 7,
|
||||
"uuid": "226768ac-c011-46dd-937f-e81a4a9f6b6a",
|
||||
"routine": 2,
|
||||
"day": null,
|
||||
"date": "2025-01-13",
|
||||
@@ -207,7 +210,7 @@
|
||||
"iteration": 2,
|
||||
"slot_entry": 2,
|
||||
"next_log": null,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"repetitions_unit": 1,
|
||||
"repetitions": "9.00",
|
||||
"repetitions_target": "10.00",
|
||||
@@ -227,7 +230,7 @@
|
||||
"iteration": 2,
|
||||
"slot_entry": 2,
|
||||
"next_log": null,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"repetitions_unit": 1,
|
||||
"repetitions": "10.00",
|
||||
"repetitions_target": "10.00",
|
||||
@@ -247,7 +250,7 @@
|
||||
"iteration": 2,
|
||||
"slot_entry": 2,
|
||||
"next_log": null,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"repetitions_unit": 1,
|
||||
"repetitions": "10.00",
|
||||
"repetitions_target": "10.00",
|
||||
@@ -267,7 +270,7 @@
|
||||
"iteration": 2,
|
||||
"slot_entry": 2,
|
||||
"next_log": null,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"repetitions_unit": 1,
|
||||
"repetitions": "12.00",
|
||||
"repetitions_target": "10.00",
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
{
|
||||
"id": 2,
|
||||
"slot": 2,
|
||||
"exercise": 76,
|
||||
"exercise": 4,
|
||||
"order": 1,
|
||||
"comment": "",
|
||||
"type": "normal",
|
||||
@@ -129,7 +129,7 @@
|
||||
{
|
||||
"id": 3,
|
||||
"slot": 3,
|
||||
"exercise": 92,
|
||||
"exercise": 6,
|
||||
"order": 1,
|
||||
"comment": "",
|
||||
"type": "normal",
|
||||
|
||||
@@ -54,7 +54,7 @@ void main() {
|
||||
testWidgets('renders correctly for an existing session', (WidgetTester tester) async {
|
||||
//Arrange
|
||||
final existingSession = WorkoutSession(
|
||||
id: 1,
|
||||
id: '1',
|
||||
routineId: 1,
|
||||
notes: 'Existing notes',
|
||||
impression: 1,
|
||||
@@ -80,7 +80,7 @@ void main() {
|
||||
await pumpSessionForm(tester, onSaved: () => onSavedCalled = true);
|
||||
|
||||
when(mockRoutinesProvider.addSession(any, any)).thenAnswer(
|
||||
(_) async => WorkoutSession(id: 1, routineId: 1, date: DateTime.now()),
|
||||
(_) async => WorkoutSession(id: '1', routineId: 1, date: DateTime.now()),
|
||||
);
|
||||
|
||||
// Act
|
||||
@@ -97,7 +97,7 @@ void main() {
|
||||
// Arrange
|
||||
bool onSavedCalled = false;
|
||||
final existingSession = WorkoutSession(
|
||||
id: 1,
|
||||
id: '1',
|
||||
routineId: 1,
|
||||
notes: 'Old notes',
|
||||
impression: 2,
|
||||
@@ -105,7 +105,7 @@ void main() {
|
||||
);
|
||||
when(mockRoutinesProvider.editSession(any)).thenAnswer(
|
||||
(_) async => WorkoutSession(
|
||||
id: 1,
|
||||
id: '1',
|
||||
routineId: 1,
|
||||
date: DateTime.now(),
|
||||
),
|
||||
|
||||
@@ -26,8 +26,9 @@ import 'package:provider/provider.dart';
|
||||
import 'package:shared_preferences_platform_interface/in_memory_shared_preferences_async.dart';
|
||||
import 'package:shared_preferences_platform_interface/shared_preferences_async_platform_interface.dart';
|
||||
import 'package:wger/l10n/generated/app_localizations.dart';
|
||||
import 'package:wger/providers/base_provider.dart';
|
||||
import 'package:wger/providers/exercises.dart';
|
||||
import 'package:wger/models/exercises/category.dart';
|
||||
import 'package:wger/models/exercises/equipment.dart';
|
||||
import 'package:wger/providers/exercise_data.dart';
|
||||
import 'package:wger/providers/routines.dart';
|
||||
import 'package:wger/screens/gym_mode.dart';
|
||||
import 'package:wger/screens/routine_screen.dart';
|
||||
@@ -44,22 +45,16 @@ import '../../test_data/exercises.dart';
|
||||
import '../../test_data/routines.dart';
|
||||
import 'gym_mode_screen_test.mocks.dart';
|
||||
|
||||
@GenerateMocks([WgerBaseProvider, ExercisesProvider, RoutinesProvider])
|
||||
@GenerateMocks([RoutinesProvider])
|
||||
void main() {
|
||||
final key = GlobalKey<NavigatorState>();
|
||||
|
||||
final mockRoutinesProvider = MockRoutinesProvider();
|
||||
final mockExerciseProvider = MockExercisesProvider();
|
||||
final testRoutine = getTestRoutine();
|
||||
final testExercises = getTestExercises();
|
||||
|
||||
setUp(() {
|
||||
when(mockRoutinesProvider.findById(any)).thenReturn(testRoutine);
|
||||
when(mockRoutinesProvider.items).thenReturn([testRoutine]);
|
||||
when(mockRoutinesProvider.repetitionUnits).thenReturn(testRepetitionUnits);
|
||||
when(mockRoutinesProvider.getRepetitionUnitById(1)).thenReturn(testRepetitionUnit1);
|
||||
when(mockRoutinesProvider.weightUnits).thenReturn(testWeightUnits);
|
||||
when(mockRoutinesProvider.getWeightUnitById(1)).thenReturn(testWeightUnit1);
|
||||
when(
|
||||
mockRoutinesProvider.fetchAndSetRoutineFull(any),
|
||||
).thenAnswer((_) => Future.value(testRoutine));
|
||||
@@ -70,40 +65,43 @@ void main() {
|
||||
Widget renderGymMode({locale = 'en'}) {
|
||||
return ChangeNotifierProvider<RoutinesProvider>(
|
||||
create: (context) => mockRoutinesProvider,
|
||||
child: ChangeNotifierProvider<ExercisesProvider>(
|
||||
create: (context) => mockExerciseProvider,
|
||||
child: riverpod.ProviderScope(
|
||||
child: MaterialApp(
|
||||
locale: Locale(locale),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
navigatorKey: key,
|
||||
home: TextButton(
|
||||
onPressed: () => key.currentState!.push(
|
||||
MaterialPageRoute<void>(
|
||||
settings: const RouteSettings(arguments: GymModeArguments(1, 1, 1)),
|
||||
builder: (_) => const GymModeScreen(),
|
||||
),
|
||||
),
|
||||
child: const SizedBox(),
|
||||
),
|
||||
routes: {RoutineScreen.routeName: (ctx) => const RoutineScreen()},
|
||||
child: riverpod.ProviderScope(
|
||||
overrides: [
|
||||
exercisesProvider.overrideWithValue(riverpod.AsyncValue.data(getTestExercises())),
|
||||
exerciseEquipmentProvider.overrideWithValue(
|
||||
const riverpod.AsyncValue.data(<Equipment>[]),
|
||||
),
|
||||
exerciseCategoriesProvider.overrideWithValue(
|
||||
const riverpod.AsyncValue.data(<ExerciseCategory>[]),
|
||||
),
|
||||
routineRepetitionUnitProvider.overrideWithValue(
|
||||
const riverpod.AsyncValue.data(testRepetitionUnits),
|
||||
),
|
||||
routineWeightUnitProvider.overrideWithValue(
|
||||
const riverpod.AsyncValue.data(testWeightUnits),
|
||||
),
|
||||
],
|
||||
child: MaterialApp(
|
||||
locale: Locale(locale),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
navigatorKey: key,
|
||||
home: TextButton(
|
||||
onPressed: () => key.currentState!.push(
|
||||
MaterialPageRoute<void>(
|
||||
settings: const RouteSettings(arguments: GymModeArguments(1, 1, 1)),
|
||||
builder: (_) => const GymModeScreen(),
|
||||
),
|
||||
),
|
||||
child: const SizedBox(),
|
||||
),
|
||||
routes: {RoutineScreen.routeName: (ctx) => const RoutineScreen()},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('Test the widgets on the gym mode screen', (WidgetTester tester) async {
|
||||
when(mockExerciseProvider.findExerciseById(1)).thenReturn(testExercises[0]);
|
||||
when(mockExerciseProvider.findExerciseById(6)).thenReturn(testExercises[5]);
|
||||
when(
|
||||
mockExerciseProvider.findExercisesByVariationId(
|
||||
null,
|
||||
exerciseIdToExclude: anyNamed('exerciseIdToExclude'),
|
||||
),
|
||||
).thenReturn([]);
|
||||
|
||||
await withClock(Clock.fixed(DateTime(2025, 3, 29, 14, 33)), () async {
|
||||
await tester.pumpWidget(renderGymMode());
|
||||
|
||||
|
||||
@@ -4,29 +4,22 @@
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i13;
|
||||
import 'dart:ui' as _i20;
|
||||
import 'dart:ui' as _i16;
|
||||
|
||||
import 'package:http/http.dart' as _i3;
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:mockito/src/dummies.dart' as _i23;
|
||||
import 'package:wger/models/exercises/category.dart' as _i16;
|
||||
import 'package:wger/models/exercises/equipment.dart' as _i18;
|
||||
import 'package:wger/models/exercises/exercise.dart' as _i15;
|
||||
import 'package:wger/models/exercises/language.dart' as _i19;
|
||||
import 'package:wger/models/exercises/muscle.dart' as _i17;
|
||||
import 'package:wger/models/workouts/base_config.dart' as _i11;
|
||||
import 'package:wger/models/workouts/day.dart' as _i8;
|
||||
import 'package:wger/models/workouts/day_data.dart' as _i22;
|
||||
import 'package:wger/models/workouts/repetition_unit.dart' as _i6;
|
||||
import 'package:wger/models/workouts/routine.dart' as _i7;
|
||||
import 'package:wger/models/workouts/session.dart' as _i12;
|
||||
import 'package:wger/models/workouts/slot.dart' as _i9;
|
||||
import 'package:wger/models/workouts/slot_entry.dart' as _i10;
|
||||
import 'package:wger/models/workouts/weight_unit.dart' as _i5;
|
||||
import 'package:wger/providers/auth.dart' as _i2;
|
||||
import 'package:wger/providers/base_provider.dart' as _i4;
|
||||
import 'package:wger/providers/exercises.dart' as _i14;
|
||||
import 'package:wger/providers/routines.dart' as _i21;
|
||||
import 'package:mockito/src/dummies.dart' as _i15;
|
||||
import 'package:wger/models/exercises/exercise.dart' as _i12;
|
||||
import 'package:wger/models/workouts/base_config.dart' as _i9;
|
||||
import 'package:wger/models/workouts/day.dart' as _i6;
|
||||
import 'package:wger/models/workouts/day_data.dart' as _i14;
|
||||
import 'package:wger/models/workouts/repetition_unit.dart' as _i4;
|
||||
import 'package:wger/models/workouts/routine.dart' as _i5;
|
||||
import 'package:wger/models/workouts/session.dart' as _i10;
|
||||
import 'package:wger/models/workouts/slot.dart' as _i7;
|
||||
import 'package:wger/models/workouts/slot_entry.dart' as _i8;
|
||||
import 'package:wger/models/workouts/weight_unit.dart' as _i3;
|
||||
import 'package:wger/providers/base_provider.dart' as _i2;
|
||||
import 'package:wger/providers/routines.dart' as _i11;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
@@ -42,394 +35,130 @@ import 'package:wger/providers/routines.dart' as _i21;
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider {
|
||||
_FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeClient_1 extends _i1.SmartFake implements _i3.Client {
|
||||
_FakeClient_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeUri_2 extends _i1.SmartFake implements Uri {
|
||||
_FakeUri_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response {
|
||||
_FakeResponse_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeWgerBaseProvider_4 extends _i1.SmartFake implements _i4.WgerBaseProvider {
|
||||
_FakeWgerBaseProvider_4(Object parent, Invocation parentInvocation)
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
|
||||
_FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeWeightUnit_5 extends _i1.SmartFake implements _i5.WeightUnit {
|
||||
_FakeWeightUnit_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit {
|
||||
_FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeRepetitionUnit_6 extends _i1.SmartFake implements _i6.RepetitionUnit {
|
||||
_FakeRepetitionUnit_6(Object parent, Invocation parentInvocation)
|
||||
class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit {
|
||||
_FakeRepetitionUnit_2(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeRoutine_7 extends _i1.SmartFake implements _i7.Routine {
|
||||
_FakeRoutine_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine {
|
||||
_FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeDay_8 extends _i1.SmartFake implements _i8.Day {
|
||||
_FakeDay_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
class _FakeDay_4 extends _i1.SmartFake implements _i6.Day {
|
||||
_FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeSlot_9 extends _i1.SmartFake implements _i9.Slot {
|
||||
_FakeSlot_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot {
|
||||
_FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeSlotEntry_10 extends _i1.SmartFake implements _i10.SlotEntry {
|
||||
_FakeSlotEntry_10(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry {
|
||||
_FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeBaseConfig_11 extends _i1.SmartFake implements _i11.BaseConfig {
|
||||
_FakeBaseConfig_11(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig {
|
||||
_FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeWorkoutSession_12 extends _i1.SmartFake implements _i12.WorkoutSession {
|
||||
_FakeWorkoutSession_12(Object parent, Invocation parentInvocation)
|
||||
class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession {
|
||||
_FakeWorkoutSession_8(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
/// A class which mocks [WgerBaseProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
MockWgerBaseProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i2.AuthProvider get auth =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#auth),
|
||||
returnValue: _FakeAuthProvider_0(this, Invocation.getter(#auth)),
|
||||
)
|
||||
as _i2.AuthProvider);
|
||||
|
||||
@override
|
||||
_i3.Client get client =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#client),
|
||||
returnValue: _FakeClient_1(this, Invocation.getter(#client)),
|
||||
)
|
||||
as _i3.Client);
|
||||
|
||||
@override
|
||||
set auth(_i2.AuthProvider? _auth) => super.noSuchMethod(
|
||||
Invocation.setter(#auth, _auth),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
set client(_i3.Client? _client) => super.noSuchMethod(
|
||||
Invocation.setter(#client, _client),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
Map<String, String> getDefaultHeaders({bool? includeAuth = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getDefaultHeaders, [], {
|
||||
#includeAuth: includeAuth,
|
||||
}),
|
||||
returnValue: <String, String>{},
|
||||
)
|
||||
as Map<String, String>);
|
||||
|
||||
@override
|
||||
Uri makeUrl(
|
||||
String? path, {
|
||||
int? id,
|
||||
String? objectMethod,
|
||||
Map<String, dynamic>? query,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#makeUrl,
|
||||
[path],
|
||||
{#id: id, #objectMethod: objectMethod, #query: query},
|
||||
),
|
||||
returnValue: _FakeUri_2(
|
||||
this,
|
||||
Invocation.method(
|
||||
#makeUrl,
|
||||
[path],
|
||||
{#id: id, #objectMethod: objectMethod, #query: query},
|
||||
),
|
||||
),
|
||||
)
|
||||
as Uri);
|
||||
|
||||
@override
|
||||
_i13.Future<dynamic> fetch(Uri? uri) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetch, [uri]),
|
||||
returnValue: _i13.Future<dynamic>.value(),
|
||||
)
|
||||
as _i13.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i13.Future<List<dynamic>> fetchPaginated(Uri? uri) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchPaginated, [uri]),
|
||||
returnValue: _i13.Future<List<dynamic>>.value(<dynamic>[]),
|
||||
)
|
||||
as _i13.Future<List<dynamic>>);
|
||||
|
||||
@override
|
||||
_i13.Future<Map<String, dynamic>> post(
|
||||
Map<String, dynamic>? data,
|
||||
Uri? uri,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#post, [data, uri]),
|
||||
returnValue: _i13.Future<Map<String, dynamic>>.value(
|
||||
<String, dynamic>{},
|
||||
),
|
||||
)
|
||||
as _i13.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
_i13.Future<Map<String, dynamic>> patch(
|
||||
Map<String, dynamic>? data,
|
||||
Uri? uri,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#patch, [data, uri]),
|
||||
returnValue: _i13.Future<Map<String, dynamic>>.value(
|
||||
<String, dynamic>{},
|
||||
),
|
||||
)
|
||||
as _i13.Future<Map<String, dynamic>>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i3.Response> deleteRequest(String? url, int? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#deleteRequest, [url, id]),
|
||||
returnValue: _i13.Future<_i3.Response>.value(
|
||||
_FakeResponse_3(
|
||||
this,
|
||||
Invocation.method(#deleteRequest, [url, id]),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i13.Future<_i3.Response>);
|
||||
}
|
||||
|
||||
/// A class which mocks [ExercisesProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockExercisesProvider extends _i1.Mock implements _i14.ExercisesProvider {
|
||||
MockExercisesProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i4.WgerBaseProvider get baseProvider =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#baseProvider),
|
||||
returnValue: _FakeWgerBaseProvider_4(
|
||||
this,
|
||||
Invocation.getter(#baseProvider),
|
||||
),
|
||||
)
|
||||
as _i4.WgerBaseProvider);
|
||||
|
||||
@override
|
||||
List<_i15.Exercise> get exercises =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#exercises),
|
||||
returnValue: <_i15.Exercise>[],
|
||||
)
|
||||
as List<_i15.Exercise>);
|
||||
|
||||
@override
|
||||
Map<int, List<_i15.Exercise>> get exerciseByVariation =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#exerciseByVariation),
|
||||
returnValue: <int, List<_i15.Exercise>>{},
|
||||
)
|
||||
as Map<int, List<_i15.Exercise>>);
|
||||
|
||||
@override
|
||||
List<_i16.ExerciseCategory> get categories =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#categories),
|
||||
returnValue: <_i16.ExerciseCategory>[],
|
||||
)
|
||||
as List<_i16.ExerciseCategory>);
|
||||
|
||||
@override
|
||||
List<_i17.Muscle> get muscles =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#muscles),
|
||||
returnValue: <_i17.Muscle>[],
|
||||
)
|
||||
as List<_i17.Muscle>);
|
||||
|
||||
@override
|
||||
List<_i18.Equipment> get equipment =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#equipment),
|
||||
returnValue: <_i18.Equipment>[],
|
||||
)
|
||||
as List<_i18.Equipment>);
|
||||
|
||||
@override
|
||||
List<_i19.Language> get languages =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#languages),
|
||||
returnValue: <_i19.Language>[],
|
||||
)
|
||||
as List<_i19.Language>);
|
||||
|
||||
@override
|
||||
set exercises(List<_i15.Exercise>? _exercises) => super.noSuchMethod(
|
||||
Invocation.setter(#exercises, _exercises),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
set languages(List<_i19.Language>? languages) => super.noSuchMethod(
|
||||
Invocation.setter(#languages, languages),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
bool get hasListeners =>
|
||||
(super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool);
|
||||
|
||||
@override
|
||||
void clear() => super.noSuchMethod(
|
||||
Invocation.method(#clear, []),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
_i13.Future<_i15.Exercise?> fetchAndSetExercise(int? exerciseId) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchAndSetExercise, [exerciseId]),
|
||||
returnValue: _i13.Future<_i15.Exercise?>.value(),
|
||||
)
|
||||
as _i13.Future<_i15.Exercise?>);
|
||||
|
||||
@override
|
||||
void addListener(_i20.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
void removeListener(_i20.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(#removeListener, [listener]),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
void dispose() => super.noSuchMethod(
|
||||
Invocation.method(#dispose, []),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
void notifyListeners() => super.noSuchMethod(
|
||||
Invocation.method(#notifyListeners, []),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
}
|
||||
|
||||
/// A class which mocks [RoutinesProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockRoutinesProvider extends _i1.Mock implements _i21.RoutinesProvider {
|
||||
class MockRoutinesProvider extends _i1.Mock implements _i11.RoutinesProvider {
|
||||
MockRoutinesProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i4.WgerBaseProvider get baseProvider =>
|
||||
_i2.WgerBaseProvider get baseProvider =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#baseProvider),
|
||||
returnValue: _FakeWgerBaseProvider_4(
|
||||
returnValue: _FakeWgerBaseProvider_0(
|
||||
this,
|
||||
Invocation.getter(#baseProvider),
|
||||
),
|
||||
)
|
||||
as _i4.WgerBaseProvider);
|
||||
as _i2.WgerBaseProvider);
|
||||
|
||||
@override
|
||||
List<_i5.WeightUnit> get weightUnits =>
|
||||
List<_i3.WeightUnit> get weightUnits =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#weightUnits),
|
||||
returnValue: <_i5.WeightUnit>[],
|
||||
returnValue: <_i3.WeightUnit>[],
|
||||
)
|
||||
as List<_i5.WeightUnit>);
|
||||
as List<_i3.WeightUnit>);
|
||||
|
||||
@override
|
||||
List<_i7.Routine> get items =>
|
||||
List<_i5.Routine> get items =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#items),
|
||||
returnValue: <_i7.Routine>[],
|
||||
returnValue: <_i5.Routine>[],
|
||||
)
|
||||
as List<_i7.Routine>);
|
||||
as List<_i5.Routine>);
|
||||
|
||||
@override
|
||||
_i5.WeightUnit get defaultWeightUnit =>
|
||||
_i3.WeightUnit get defaultWeightUnit =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#defaultWeightUnit),
|
||||
returnValue: _FakeWeightUnit_5(
|
||||
returnValue: _FakeWeightUnit_1(
|
||||
this,
|
||||
Invocation.getter(#defaultWeightUnit),
|
||||
),
|
||||
)
|
||||
as _i5.WeightUnit);
|
||||
as _i3.WeightUnit);
|
||||
|
||||
@override
|
||||
List<_i6.RepetitionUnit> get repetitionUnits =>
|
||||
List<_i4.RepetitionUnit> get repetitionUnits =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#repetitionUnits),
|
||||
returnValue: <_i6.RepetitionUnit>[],
|
||||
returnValue: <_i4.RepetitionUnit>[],
|
||||
)
|
||||
as List<_i6.RepetitionUnit>);
|
||||
as List<_i4.RepetitionUnit>);
|
||||
|
||||
@override
|
||||
_i6.RepetitionUnit get defaultRepetitionUnit =>
|
||||
_i4.RepetitionUnit get defaultRepetitionUnit =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#defaultRepetitionUnit),
|
||||
returnValue: _FakeRepetitionUnit_6(
|
||||
returnValue: _FakeRepetitionUnit_2(
|
||||
this,
|
||||
Invocation.getter(#defaultRepetitionUnit),
|
||||
),
|
||||
)
|
||||
as _i6.RepetitionUnit);
|
||||
as _i4.RepetitionUnit);
|
||||
|
||||
@override
|
||||
set activeRoutine(_i7.Routine? _activeRoutine) => super.noSuchMethod(
|
||||
set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod(
|
||||
Invocation.setter(#activeRoutine, _activeRoutine),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
set exercises(List<_i15.Exercise>? exercises) => super.noSuchMethod(
|
||||
set exercises(List<_i12.Exercise>? exercises) => super.noSuchMethod(
|
||||
Invocation.setter(#exercises, exercises),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
set repetitionUnits(List<_i6.RepetitionUnit>? units) => super.noSuchMethod(
|
||||
set repetitionUnits(List<_i4.RepetitionUnit>? units) => super.noSuchMethod(
|
||||
Invocation.setter(#repetitionUnits, units),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
set weightUnits(List<_i5.WeightUnit>? units) => super.noSuchMethod(
|
||||
set weightUnits(List<_i3.WeightUnit>? units) => super.noSuchMethod(
|
||||
Invocation.setter(#weightUnits, units),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
@@ -439,26 +168,26 @@ class MockRoutinesProvider extends _i1.Mock implements _i21.RoutinesProvider {
|
||||
(super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool);
|
||||
|
||||
@override
|
||||
_i6.RepetitionUnit getRepetitionUnitById(int? id) =>
|
||||
_i4.RepetitionUnit getRepetitionUnitById(int? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getRepetitionUnitById, [id]),
|
||||
returnValue: _FakeRepetitionUnit_6(
|
||||
returnValue: _FakeRepetitionUnit_2(
|
||||
this,
|
||||
Invocation.method(#getRepetitionUnitById, [id]),
|
||||
),
|
||||
)
|
||||
as _i6.RepetitionUnit);
|
||||
as _i4.RepetitionUnit);
|
||||
|
||||
@override
|
||||
_i5.WeightUnit getWeightUnitById(int? id) =>
|
||||
_i3.WeightUnit getWeightUnitById(int? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getWeightUnitById, [id]),
|
||||
returnValue: _FakeWeightUnit_5(
|
||||
returnValue: _FakeWeightUnit_1(
|
||||
this,
|
||||
Invocation.method(#getWeightUnitById, [id]),
|
||||
),
|
||||
)
|
||||
as _i5.WeightUnit);
|
||||
as _i3.WeightUnit);
|
||||
|
||||
@override
|
||||
void clear() => super.noSuchMethod(
|
||||
@@ -467,23 +196,23 @@ class MockRoutinesProvider extends _i1.Mock implements _i21.RoutinesProvider {
|
||||
);
|
||||
|
||||
@override
|
||||
List<_i7.Routine> getPlans() =>
|
||||
List<_i5.Routine> getPlans() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getPlans, []),
|
||||
returnValue: <_i7.Routine>[],
|
||||
returnValue: <_i5.Routine>[],
|
||||
)
|
||||
as List<_i7.Routine>);
|
||||
as List<_i5.Routine>);
|
||||
|
||||
@override
|
||||
_i7.Routine findById(int? id) =>
|
||||
_i5.Routine findById(int? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#findById, [id]),
|
||||
returnValue: _FakeRoutine_7(
|
||||
returnValue: _FakeRoutine_3(
|
||||
this,
|
||||
Invocation.method(#findById, [id]),
|
||||
),
|
||||
)
|
||||
as _i7.Routine);
|
||||
as _i5.Routine);
|
||||
|
||||
@override
|
||||
int findIndexById(int? id) =>
|
||||
@@ -513,8 +242,8 @@ class MockRoutinesProvider extends _i1.Mock implements _i21.RoutinesProvider {
|
||||
|
||||
@override
|
||||
_i13.Future<void> setExercisesAndUnits(
|
||||
List<_i22.DayData>? entries, {
|
||||
Map<int, _i15.Exercise>? exercises,
|
||||
List<_i14.DayData>? entries, {
|
||||
Map<int, _i12.Exercise>? exercises,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
@@ -528,43 +257,43 @@ class MockRoutinesProvider extends _i1.Mock implements _i21.RoutinesProvider {
|
||||
as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i7.Routine> fetchAndSetRoutineSparse(int? planId) =>
|
||||
_i13.Future<_i5.Routine> fetchAndSetRoutineSparse(int? planId) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchAndSetRoutineSparse, [planId]),
|
||||
returnValue: _i13.Future<_i7.Routine>.value(
|
||||
_FakeRoutine_7(
|
||||
returnValue: _i13.Future<_i5.Routine>.value(
|
||||
_FakeRoutine_3(
|
||||
this,
|
||||
Invocation.method(#fetchAndSetRoutineSparse, [planId]),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i13.Future<_i7.Routine>);
|
||||
as _i13.Future<_i5.Routine>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i7.Routine> fetchAndSetRoutineFull(int? routineId) =>
|
||||
_i13.Future<_i5.Routine> fetchAndSetRoutineFull(int? routineId) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchAndSetRoutineFull, [routineId]),
|
||||
returnValue: _i13.Future<_i7.Routine>.value(
|
||||
_FakeRoutine_7(
|
||||
returnValue: _i13.Future<_i5.Routine>.value(
|
||||
_FakeRoutine_3(
|
||||
this,
|
||||
Invocation.method(#fetchAndSetRoutineFull, [routineId]),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i13.Future<_i7.Routine>);
|
||||
as _i13.Future<_i5.Routine>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i7.Routine> addRoutine(_i7.Routine? routine) =>
|
||||
_i13.Future<_i5.Routine> addRoutine(_i5.Routine? routine) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addRoutine, [routine]),
|
||||
returnValue: _i13.Future<_i7.Routine>.value(
|
||||
_FakeRoutine_7(this, Invocation.method(#addRoutine, [routine])),
|
||||
returnValue: _i13.Future<_i5.Routine>.value(
|
||||
_FakeRoutine_3(this, Invocation.method(#addRoutine, [routine])),
|
||||
),
|
||||
)
|
||||
as _i13.Future<_i7.Routine>);
|
||||
as _i13.Future<_i5.Routine>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editRoutine(_i7.Routine? routine) =>
|
||||
_i13.Future<void> editRoutine(_i5.Routine? routine) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#editRoutine, [routine]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
@@ -582,17 +311,17 @@ class MockRoutinesProvider extends _i1.Mock implements _i21.RoutinesProvider {
|
||||
as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i8.Day> addDay(_i8.Day? day) =>
|
||||
_i13.Future<_i6.Day> addDay(_i6.Day? day) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addDay, [day]),
|
||||
returnValue: _i13.Future<_i8.Day>.value(
|
||||
_FakeDay_8(this, Invocation.method(#addDay, [day])),
|
||||
returnValue: _i13.Future<_i6.Day>.value(
|
||||
_FakeDay_4(this, Invocation.method(#addDay, [day])),
|
||||
),
|
||||
)
|
||||
as _i13.Future<_i8.Day>);
|
||||
as _i13.Future<_i6.Day>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editDay(_i8.Day? day) =>
|
||||
_i13.Future<void> editDay(_i6.Day? day) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#editDay, [day]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
@@ -601,7 +330,7 @@ class MockRoutinesProvider extends _i1.Mock implements _i21.RoutinesProvider {
|
||||
as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editDays(List<_i8.Day>? days) =>
|
||||
_i13.Future<void> editDays(List<_i6.Day>? days) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#editDays, [days]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
@@ -619,14 +348,14 @@ class MockRoutinesProvider extends _i1.Mock implements _i21.RoutinesProvider {
|
||||
as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i9.Slot> addSlot(_i9.Slot? slot, int? routineId) =>
|
||||
_i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<_i9.Slot>.value(
|
||||
_FakeSlot_9(this, Invocation.method(#addSlot, [slot, routineId])),
|
||||
returnValue: _i13.Future<_i7.Slot>.value(
|
||||
_FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])),
|
||||
),
|
||||
)
|
||||
as _i13.Future<_i9.Slot>);
|
||||
as _i13.Future<_i7.Slot>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlot(int? slotId, int? routineId) =>
|
||||
@@ -638,7 +367,7 @@ class MockRoutinesProvider extends _i1.Mock implements _i21.RoutinesProvider {
|
||||
as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlot(_i9.Slot? slot, int? routineId) =>
|
||||
_i13.Future<void> editSlot(_i7.Slot? slot, int? routineId) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#editSlot, [slot, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
@@ -647,7 +376,7 @@ class MockRoutinesProvider extends _i1.Mock implements _i21.RoutinesProvider {
|
||||
as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlots(List<_i9.Slot>? slots, int? routineId) =>
|
||||
_i13.Future<void> editSlots(List<_i7.Slot>? slots, int? routineId) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#editSlots, [slots, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
@@ -656,20 +385,20 @@ class MockRoutinesProvider extends _i1.Mock implements _i21.RoutinesProvider {
|
||||
as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i10.SlotEntry> addSlotEntry(
|
||||
_i10.SlotEntry? entry,
|
||||
_i13.Future<_i8.SlotEntry> addSlotEntry(
|
||||
_i8.SlotEntry? entry,
|
||||
int? routineId,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<_i10.SlotEntry>.value(
|
||||
_FakeSlotEntry_10(
|
||||
returnValue: _i13.Future<_i8.SlotEntry>.value(
|
||||
_FakeSlotEntry_6(
|
||||
this,
|
||||
Invocation.method(#addSlotEntry, [entry, routineId]),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i13.Future<_i10.SlotEntry>);
|
||||
as _i13.Future<_i8.SlotEntry>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteSlotEntry(int? id, int? routineId) =>
|
||||
@@ -681,7 +410,7 @@ class MockRoutinesProvider extends _i1.Mock implements _i21.RoutinesProvider {
|
||||
as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSlotEntry(_i10.SlotEntry? entry, int? routineId) =>
|
||||
_i13.Future<void> editSlotEntry(_i8.SlotEntry? entry, int? routineId) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#editSlotEntry, [entry, routineId]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
@@ -690,10 +419,10 @@ class MockRoutinesProvider extends _i1.Mock implements _i21.RoutinesProvider {
|
||||
as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
String getConfigUrl(_i10.ConfigType? type) =>
|
||||
String getConfigUrl(_i8.ConfigType? type) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getConfigUrl, [type]),
|
||||
returnValue: _i23.dummyValue<String>(
|
||||
returnValue: _i15.dummyValue<String>(
|
||||
this,
|
||||
Invocation.method(#getConfigUrl, [type]),
|
||||
),
|
||||
@@ -701,39 +430,39 @@ class MockRoutinesProvider extends _i1.Mock implements _i21.RoutinesProvider {
|
||||
as String);
|
||||
|
||||
@override
|
||||
_i13.Future<_i11.BaseConfig> editConfig(
|
||||
_i11.BaseConfig? config,
|
||||
_i10.ConfigType? type,
|
||||
_i13.Future<_i9.BaseConfig> editConfig(
|
||||
_i9.BaseConfig? config,
|
||||
_i8.ConfigType? type,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#editConfig, [config, type]),
|
||||
returnValue: _i13.Future<_i11.BaseConfig>.value(
|
||||
_FakeBaseConfig_11(
|
||||
returnValue: _i13.Future<_i9.BaseConfig>.value(
|
||||
_FakeBaseConfig_7(
|
||||
this,
|
||||
Invocation.method(#editConfig, [config, type]),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i13.Future<_i11.BaseConfig>);
|
||||
as _i13.Future<_i9.BaseConfig>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i11.BaseConfig> addConfig(
|
||||
_i11.BaseConfig? config,
|
||||
_i10.ConfigType? type,
|
||||
_i13.Future<_i9.BaseConfig> addConfig(
|
||||
_i9.BaseConfig? config,
|
||||
_i8.ConfigType? type,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addConfig, [config, type]),
|
||||
returnValue: _i13.Future<_i11.BaseConfig>.value(
|
||||
_FakeBaseConfig_11(
|
||||
returnValue: _i13.Future<_i9.BaseConfig>.value(
|
||||
_FakeBaseConfig_7(
|
||||
this,
|
||||
Invocation.method(#addConfig, [config, type]),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i13.Future<_i11.BaseConfig>);
|
||||
as _i13.Future<_i9.BaseConfig>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> deleteConfig(int? id, _i10.ConfigType? type) =>
|
||||
_i13.Future<void> deleteConfig(int? id, _i8.ConfigType? type) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#deleteConfig, [id, type]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
@@ -743,9 +472,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i21.RoutinesProvider {
|
||||
|
||||
@override
|
||||
_i13.Future<void> handleConfig(
|
||||
_i10.SlotEntry? entry,
|
||||
_i8.SlotEntry? entry,
|
||||
num? value,
|
||||
_i10.ConfigType? type,
|
||||
_i8.ConfigType? type,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#handleConfig, [entry, value, type]),
|
||||
@@ -755,33 +484,33 @@ class MockRoutinesProvider extends _i1.Mock implements _i21.RoutinesProvider {
|
||||
as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
_i13.Future<List<_i12.WorkoutSession>> fetchSessionData() =>
|
||||
_i13.Future<List<_i10.WorkoutSession>> fetchSessionData() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchSessionData, []),
|
||||
returnValue: _i13.Future<List<_i12.WorkoutSession>>.value(
|
||||
<_i12.WorkoutSession>[],
|
||||
returnValue: _i13.Future<List<_i10.WorkoutSession>>.value(
|
||||
<_i10.WorkoutSession>[],
|
||||
),
|
||||
)
|
||||
as _i13.Future<List<_i12.WorkoutSession>>);
|
||||
as _i13.Future<List<_i10.WorkoutSession>>);
|
||||
|
||||
@override
|
||||
_i13.Future<_i12.WorkoutSession> addSession(
|
||||
_i12.WorkoutSession? session,
|
||||
_i13.Future<_i10.WorkoutSession> addSession(
|
||||
_i10.WorkoutSession? session,
|
||||
int? routineId,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addSession, [session, routineId]),
|
||||
returnValue: _i13.Future<_i12.WorkoutSession>.value(
|
||||
_FakeWorkoutSession_12(
|
||||
returnValue: _i13.Future<_i10.WorkoutSession>.value(
|
||||
_FakeWorkoutSession_8(
|
||||
this,
|
||||
Invocation.method(#addSession, [session, routineId]),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i13.Future<_i12.WorkoutSession>);
|
||||
as _i13.Future<_i10.WorkoutSession>);
|
||||
|
||||
@override
|
||||
_i13.Future<void> editSession(_i12.WorkoutSession? session) =>
|
||||
_i13.Future<void> editSession(_i10.WorkoutSession? session) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#editSession, [session]),
|
||||
returnValue: _i13.Future<void>.value(),
|
||||
@@ -799,13 +528,13 @@ class MockRoutinesProvider extends _i1.Mock implements _i21.RoutinesProvider {
|
||||
as _i13.Future<void>);
|
||||
|
||||
@override
|
||||
void addListener(_i20.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i16.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
void removeListener(_i20.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(#removeListener, [listener]),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@@ -19,49 +19,49 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart' as riverpod;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/l10n/generated/app_localizations.dart';
|
||||
import 'package:wger/providers/base_provider.dart';
|
||||
import 'package:wger/providers/exercises.dart';
|
||||
import 'package:wger/providers/routines.dart';
|
||||
import 'package:wger/screens/routine_screen.dart';
|
||||
|
||||
import '../../test_data/exercises.dart';
|
||||
import '../../test_data/routines.dart';
|
||||
import 'routine_screen_test.mocks.dart';
|
||||
|
||||
@GenerateMocks([WgerBaseProvider])
|
||||
void main() {
|
||||
final mockBaseProvider = MockWgerBaseProvider();
|
||||
final exercisesProvider = ExercisesProvider(
|
||||
mockBaseProvider,
|
||||
);
|
||||
|
||||
Widget renderWidget({locale = 'en'}) {
|
||||
final key = GlobalKey<NavigatorState>();
|
||||
|
||||
return ChangeNotifierProvider<RoutinesProvider>(
|
||||
create: (context) => RoutinesProvider(
|
||||
mockBaseProvider,
|
||||
exercisesProvider,
|
||||
[getTestRoutine()],
|
||||
),
|
||||
child: MaterialApp(
|
||||
locale: Locale(locale),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
navigatorKey: key,
|
||||
home: TextButton(
|
||||
onPressed: () => key.currentState!.push(
|
||||
MaterialPageRoute<void>(
|
||||
settings: const RouteSettings(arguments: 1),
|
||||
builder: (_) => const RoutineScreen(),
|
||||
),
|
||||
),
|
||||
child: const SizedBox(),
|
||||
return riverpod.ProviderScope(
|
||||
child: ChangeNotifierProvider<RoutinesProvider>(
|
||||
create: (context) => RoutinesProvider(
|
||||
mockBaseProvider,
|
||||
entries: [getTestRoutine()],
|
||||
exercises: getTestExercises(),
|
||||
),
|
||||
child: MaterialApp(
|
||||
locale: Locale(locale),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
navigatorKey: key,
|
||||
home: TextButton(
|
||||
onPressed: () => key.currentState!.push(
|
||||
MaterialPageRoute<void>(
|
||||
settings: const RouteSettings(arguments: 1),
|
||||
builder: (_) => const RoutineScreen(),
|
||||
),
|
||||
),
|
||||
child: const SizedBox(),
|
||||
),
|
||||
routes: {RoutineScreen.routeName: (ctx) => const RoutineScreen()},
|
||||
),
|
||||
routes: {RoutineScreen.routeName: (ctx) => const RoutineScreen()},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,22 +18,16 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:shared_preferences_platform_interface/in_memory_shared_preferences_async.dart';
|
||||
import 'package:shared_preferences_platform_interface/shared_preferences_async_platform_interface.dart';
|
||||
import 'package:wger/core/locator.dart';
|
||||
import 'package:wger/helpers/consts.dart';
|
||||
import 'package:wger/helpers/shared_preferences.dart';
|
||||
import 'package:wger/models/workouts/repetition_unit.dart';
|
||||
import 'package:wger/models/workouts/routine.dart';
|
||||
import 'package:wger/models/workouts/weight_unit.dart';
|
||||
import 'package:wger/providers/base_provider.dart';
|
||||
import 'package:wger/providers/exercises.dart';
|
||||
import 'package:wger/providers/routines.dart';
|
||||
|
||||
import '../../test_data/exercises.dart';
|
||||
@@ -41,7 +35,7 @@ import '../../test_data/routines.dart';
|
||||
import '../fixtures/fixture_reader.dart';
|
||||
import 'routines_provider_test.mocks.dart';
|
||||
|
||||
@GenerateMocks([WgerBaseProvider, ExercisesProvider])
|
||||
@GenerateMocks([WgerBaseProvider])
|
||||
void main() {
|
||||
final mockBaseProvider = MockWgerBaseProvider();
|
||||
|
||||
@@ -55,8 +49,6 @@ void main() {
|
||||
|
||||
group('test the workout routine provider', () {
|
||||
test('Test fetching and setting a routine', () async {
|
||||
final exercisesProvider = ExercisesProvider(mockBaseProvider);
|
||||
|
||||
final uri = Uri.https('localhost', 'api/v2/routine/325397/');
|
||||
when(
|
||||
mockBaseProvider.makeUrl('routine', id: 325397, query: {'limit': API_MAX_PAGE_SIZE}),
|
||||
@@ -74,7 +66,7 @@ void main() {
|
||||
);
|
||||
|
||||
// Load the entries
|
||||
final provider = RoutinesProvider(mockBaseProvider, exercisesProvider, []);
|
||||
final provider = RoutinesProvider(mockBaseProvider, exercises: getTestExercises());
|
||||
final plan = await provider.fetchAndSetRoutineSparse(325397);
|
||||
final plans = provider.getPlans();
|
||||
|
||||
@@ -86,7 +78,6 @@ void main() {
|
||||
});
|
||||
|
||||
test('Test deleting a workout plan', () async {
|
||||
final exercisesProvider = ExercisesProvider(mockBaseProvider);
|
||||
final uri = Uri.https('localhost', 'api/v2/workout/325397/');
|
||||
when(mockBaseProvider.makeUrl('workout', id: 325397)).thenReturn(uri);
|
||||
when(mockBaseProvider.fetch(uri)).thenAnswer(
|
||||
@@ -102,7 +93,7 @@ void main() {
|
||||
);
|
||||
|
||||
// Load the entries
|
||||
final provider = RoutinesProvider(mockBaseProvider, exercisesProvider, []);
|
||||
final provider = RoutinesProvider(mockBaseProvider, exercises: getTestExercises());
|
||||
|
||||
await provider.fetchAndSetRoutineSparse(325397);
|
||||
await provider.deleteRoutine(325397);
|
||||
@@ -110,74 +101,6 @@ void main() {
|
||||
expect(plans.length, 0);
|
||||
});
|
||||
|
||||
test('Test that fetch and set repetition units for workout', () async {
|
||||
final exercisesProvider = ExercisesProvider(mockBaseProvider);
|
||||
|
||||
final uri = Uri.https('localhost', 'api/v2/setting-repetitionunit/');
|
||||
final tRepetitionUnits = jsonDecode(fixture('routines/repetition_units.json'));
|
||||
when(mockBaseProvider.makeUrl('setting-repetitionunit')).thenReturn(uri);
|
||||
when(
|
||||
mockBaseProvider.fetchPaginated(uri),
|
||||
).thenAnswer((_) => Future.value(tRepetitionUnits['results']));
|
||||
|
||||
// Load the entries
|
||||
final provider = RoutinesProvider(mockBaseProvider, exercisesProvider, []);
|
||||
await provider.fetchAndSetRepetitionUnits();
|
||||
final repetitionUnits = provider.repetitionUnits;
|
||||
|
||||
expect(repetitionUnits, isA<List<RepetitionUnit>>());
|
||||
expect(repetitionUnits.length, 7);
|
||||
});
|
||||
test('Test that fetch and set weight units for workout', () async {
|
||||
final uri = Uri.https('localhost', 'api/v2/setting-weightunit/');
|
||||
when(mockBaseProvider.makeUrl('setting-weightunit')).thenReturn(uri);
|
||||
final tWeightUnits = jsonDecode(fixture('routines/weight_units.json'));
|
||||
when(
|
||||
mockBaseProvider.fetchPaginated(uri),
|
||||
).thenAnswer((_) => Future.value(tWeightUnits['results']));
|
||||
|
||||
final ExercisesProvider testExercisesProvider = ExercisesProvider(mockBaseProvider);
|
||||
|
||||
// Load the entries
|
||||
final provider = RoutinesProvider(mockBaseProvider, testExercisesProvider, []);
|
||||
await provider.fetchAndSetWeightUnits();
|
||||
final weightUnits = provider.weightUnits;
|
||||
|
||||
expect(weightUnits, isA<List<WeightUnit>>());
|
||||
expect(weightUnits.length, 6);
|
||||
});
|
||||
|
||||
test('Test that fetch and set both type of units', () async {
|
||||
final weightUri = Uri.https('localhost', 'api/v2/setting-weightunit/');
|
||||
when(mockBaseProvider.makeUrl('setting-weightunit')).thenReturn(weightUri);
|
||||
final tWeightUnits = jsonDecode(fixture('routines/weight_units.json'));
|
||||
when(
|
||||
mockBaseProvider.fetchPaginated(weightUri),
|
||||
).thenAnswer((_) => Future.value(tWeightUnits['results']));
|
||||
|
||||
final repUnit = Uri.https('localhost', 'api/v2/setting-repetitionunit/');
|
||||
final tRepetitionUnits = jsonDecode(fixture('routines/repetition_units.json'));
|
||||
when(mockBaseProvider.makeUrl('setting-repetitionunit')).thenReturn(repUnit);
|
||||
when(
|
||||
mockBaseProvider.fetchPaginated(repUnit),
|
||||
).thenAnswer((_) => Future.value(tRepetitionUnits['results']));
|
||||
|
||||
final exercisesProvider = ExercisesProvider(mockBaseProvider);
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
final prefs = PreferenceHelper.asyncPref;
|
||||
|
||||
// Load the entries
|
||||
final provider = RoutinesProvider(mockBaseProvider, exercisesProvider, []);
|
||||
await provider.fetchAndSetUnits();
|
||||
final prefsJson = jsonDecode((await prefs.getString(PREFS_WORKOUT_UNITS))!);
|
||||
|
||||
expect(prefsJson['repetitionUnits'].length, 7);
|
||||
expect(prefsJson['weightUnit'].length, 6);
|
||||
expect(true, DateTime.parse(prefsJson['date']).isBefore(DateTime.now()));
|
||||
expect(true, DateTime.parse(prefsJson['expiresIn']).isAfter(DateTime.now()));
|
||||
});
|
||||
|
||||
test('Smoke test fetchAndSetRoutineFull', () async {
|
||||
//Arrange
|
||||
final structureUri = Uri.https('localhost', 'api/v2/routine/101/structure/');
|
||||
@@ -221,17 +144,12 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
final mockExercisesProvider = MockExercisesProvider();
|
||||
when(mockExercisesProvider.fetchAndSetExercise(76)).thenAnswer(
|
||||
(_) async => Future.value(testBenchPress),
|
||||
final provider = RoutinesProvider(
|
||||
mockBaseProvider,
|
||||
exercises: getTestExercises(),
|
||||
repetitionUnits: testRepetitionUnits,
|
||||
weightUnits: testWeightUnits,
|
||||
);
|
||||
when(mockExercisesProvider.fetchAndSetExercise(92)).thenAnswer(
|
||||
(_) async => Future.value(testCrunches),
|
||||
);
|
||||
|
||||
final provider = RoutinesProvider(mockBaseProvider, mockExercisesProvider, []);
|
||||
provider.repetitionUnits = testRepetitionUnits;
|
||||
provider.weightUnits = testWeightUnits;
|
||||
|
||||
// Act
|
||||
final result = await provider.fetchAndSetRoutineFull(101);
|
||||
|
||||
@@ -4,18 +4,11 @@
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i5;
|
||||
import 'dart:ui' as _i12;
|
||||
|
||||
import 'package:http/http.dart' as _i3;
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:wger/models/exercises/category.dart' as _i8;
|
||||
import 'package:wger/models/exercises/equipment.dart' as _i10;
|
||||
import 'package:wger/models/exercises/exercise.dart' as _i7;
|
||||
import 'package:wger/models/exercises/language.dart' as _i11;
|
||||
import 'package:wger/models/exercises/muscle.dart' as _i9;
|
||||
import 'package:wger/providers/auth.dart' as _i2;
|
||||
import 'package:wger/providers/base_provider.dart' as _i4;
|
||||
import 'package:wger/providers/exercises.dart' as _i6;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
@@ -47,11 +40,6 @@ class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response {
|
||||
_FakeResponse_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeWgerBaseProvider_4 extends _i1.SmartFake implements _i4.WgerBaseProvider {
|
||||
_FakeWgerBaseProvider_4(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
/// A class which mocks [WgerBaseProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
@@ -174,125 +162,3 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
)
|
||||
as _i5.Future<_i3.Response>);
|
||||
}
|
||||
|
||||
/// A class which mocks [ExercisesProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockExercisesProvider extends _i1.Mock implements _i6.ExercisesProvider {
|
||||
MockExercisesProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i4.WgerBaseProvider get baseProvider =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#baseProvider),
|
||||
returnValue: _FakeWgerBaseProvider_4(
|
||||
this,
|
||||
Invocation.getter(#baseProvider),
|
||||
),
|
||||
)
|
||||
as _i4.WgerBaseProvider);
|
||||
|
||||
@override
|
||||
List<_i7.Exercise> get exercises =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#exercises),
|
||||
returnValue: <_i7.Exercise>[],
|
||||
)
|
||||
as List<_i7.Exercise>);
|
||||
|
||||
@override
|
||||
Map<int, List<_i7.Exercise>> get exerciseByVariation =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#exerciseByVariation),
|
||||
returnValue: <int, List<_i7.Exercise>>{},
|
||||
)
|
||||
as Map<int, List<_i7.Exercise>>);
|
||||
|
||||
@override
|
||||
List<_i8.ExerciseCategory> get categories =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#categories),
|
||||
returnValue: <_i8.ExerciseCategory>[],
|
||||
)
|
||||
as List<_i8.ExerciseCategory>);
|
||||
|
||||
@override
|
||||
List<_i9.Muscle> get muscles =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#muscles),
|
||||
returnValue: <_i9.Muscle>[],
|
||||
)
|
||||
as List<_i9.Muscle>);
|
||||
|
||||
@override
|
||||
List<_i10.Equipment> get equipment =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#equipment),
|
||||
returnValue: <_i10.Equipment>[],
|
||||
)
|
||||
as List<_i10.Equipment>);
|
||||
|
||||
@override
|
||||
List<_i11.Language> get languages =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#languages),
|
||||
returnValue: <_i11.Language>[],
|
||||
)
|
||||
as List<_i11.Language>);
|
||||
|
||||
@override
|
||||
set exercises(List<_i7.Exercise>? _exercises) => super.noSuchMethod(
|
||||
Invocation.setter(#exercises, _exercises),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
set languages(List<_i11.Language>? languages) => super.noSuchMethod(
|
||||
Invocation.setter(#languages, languages),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
bool get hasListeners =>
|
||||
(super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool);
|
||||
|
||||
@override
|
||||
void clear() => super.noSuchMethod(
|
||||
Invocation.method(#clear, []),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
_i5.Future<_i7.Exercise?> fetchAndSetExercise(int? exerciseId) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchAndSetExercise, [exerciseId]),
|
||||
returnValue: _i5.Future<_i7.Exercise?>.value(),
|
||||
)
|
||||
as _i5.Future<_i7.Exercise?>);
|
||||
|
||||
@override
|
||||
void addListener(_i12.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(#removeListener, [listener]),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
void dispose() => super.noSuchMethod(
|
||||
Invocation.method(#dispose, []),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
void notifyListeners() => super.noSuchMethod(
|
||||
Invocation.method(#notifyListeners, []),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user