mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Annotate the needed mocks for each test
This makes it clear where they are loaded from
This commit is contained in:
@@ -8,7 +8,6 @@ import 'package:wger/screens/gym_mode.dart';
|
|||||||
import 'package:wger/screens/workout_plan_screen.dart';
|
import 'package:wger/screens/workout_plan_screen.dart';
|
||||||
import 'package:wger/theme/theme.dart';
|
import 'package:wger/theme/theme.dart';
|
||||||
|
|
||||||
import '../test/other/base_provider_test.mocks.dart';
|
|
||||||
import '../test/utils.dart';
|
import '../test/utils.dart';
|
||||||
import '../test/workout/gym_mode_screen_test.mocks.dart';
|
import '../test/workout/gym_mode_screen_test.mocks.dart';
|
||||||
import '../test_data/exercises.dart';
|
import '../test_data/exercises.dart';
|
||||||
@@ -16,7 +15,6 @@ import '../test_data/workouts.dart';
|
|||||||
|
|
||||||
Widget createGymModeScreen({locale = 'en'}) {
|
Widget createGymModeScreen({locale = 'en'}) {
|
||||||
final key = GlobalKey<NavigatorState>();
|
final key = GlobalKey<NavigatorState>();
|
||||||
final client = MockClient();
|
|
||||||
final bases = getTestExerciseBases();
|
final bases = getTestExerciseBases();
|
||||||
final workout = getWorkout();
|
final workout = getWorkout();
|
||||||
|
|
||||||
@@ -29,10 +27,9 @@ Widget createGymModeScreen({locale = 'en'}) {
|
|||||||
|
|
||||||
return ChangeNotifierProvider<WorkoutPlansProvider>(
|
return ChangeNotifierProvider<WorkoutPlansProvider>(
|
||||||
create: (context) => WorkoutPlansProvider(
|
create: (context) => WorkoutPlansProvider(
|
||||||
testAuthProvider,
|
mockBaseProvider,
|
||||||
mockExerciseProvider,
|
mockExerciseProvider,
|
||||||
[workout],
|
[workout],
|
||||||
client,
|
|
||||||
),
|
),
|
||||||
child: ChangeNotifierProvider<ExercisesProvider>(
|
child: ChangeNotifierProvider<ExercisesProvider>(
|
||||||
create: (context) => mockExerciseProvider,
|
create: (context) => mockExerciseProvider,
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:mockito/annotations.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:wger/helpers/consts.dart';
|
import 'package:wger/helpers/consts.dart';
|
||||||
@@ -29,9 +30,10 @@ import 'package:wger/providers/nutrition.dart';
|
|||||||
import 'package:wger/screens/nutritional_plan_screen.dart';
|
import 'package:wger/screens/nutritional_plan_screen.dart';
|
||||||
import 'package:wger/widgets/nutrition/forms.dart';
|
import 'package:wger/widgets/nutrition/forms.dart';
|
||||||
|
|
||||||
import './nutritional_plan_form_test.mocks.dart';
|
|
||||||
import '../../test_data/nutritional_plans.dart';
|
import '../../test_data/nutritional_plans.dart';
|
||||||
|
import 'nutritional_meal_form_test.mocks.dart';
|
||||||
|
|
||||||
|
@GenerateMocks([NutritionPlansProvider])
|
||||||
void main() {
|
void main() {
|
||||||
var mockNutrition = MockNutritionPlansProvider();
|
var mockNutrition = MockNutritionPlansProvider();
|
||||||
|
|
||||||
|
|||||||
583
test/nutrition/nutritional_meal_form_test.mocks.dart
Normal file
583
test/nutrition/nutritional_meal_form_test.mocks.dart
Normal file
@@ -0,0 +1,583 @@
|
|||||||
|
// Mocks generated by Mockito 5.3.2 from annotations
|
||||||
|
// in wger/test/nutrition/nutritional_meal_form_test.dart.
|
||||||
|
// Do not manually edit this file.
|
||||||
|
|
||||||
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
|
import 'dart:async' as _i9;
|
||||||
|
import 'dart:ui' as _i10;
|
||||||
|
|
||||||
|
import 'package:http/http.dart' as _i3;
|
||||||
|
import 'package:mockito/mockito.dart' as _i1;
|
||||||
|
import 'package:wger/models/nutrition/ingredient.dart' as _i7;
|
||||||
|
import 'package:wger/models/nutrition/meal.dart' as _i5;
|
||||||
|
import 'package:wger/models/nutrition/meal_item.dart' as _i6;
|
||||||
|
import 'package:wger/models/nutrition/nutritional_plan.dart' as _i4;
|
||||||
|
import 'package:wger/providers/auth.dart' as _i2;
|
||||||
|
import 'package:wger/providers/nutrition.dart' as _i8;
|
||||||
|
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: avoid_redundant_argument_values
|
||||||
|
// ignore_for_file: avoid_setters_without_getters
|
||||||
|
// ignore_for_file: comment_references
|
||||||
|
// ignore_for_file: implementation_imports
|
||||||
|
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
||||||
|
// ignore_for_file: prefer_const_constructors
|
||||||
|
// ignore_for_file: unnecessary_parenthesis
|
||||||
|
// 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 _FakeNutritionalPlan_2 extends _i1.SmartFake implements _i4.NutritionalPlan {
|
||||||
|
_FakeNutritionalPlan_2(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeMeal_3 extends _i1.SmartFake implements _i5.Meal {
|
||||||
|
_FakeMeal_3(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeMealItem_4 extends _i1.SmartFake implements _i6.MealItem {
|
||||||
|
_FakeMealItem_4(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeIngredient_5 extends _i1.SmartFake implements _i7.Ingredient {
|
||||||
|
_FakeIngredient_5(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeUri_6 extends _i1.SmartFake implements Uri {
|
||||||
|
_FakeUri_6(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeResponse_7 extends _i1.SmartFake implements _i3.Response {
|
||||||
|
_FakeResponse_7(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A class which mocks [NutritionPlansProvider].
|
||||||
|
///
|
||||||
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
|
class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansProvider {
|
||||||
|
MockNutritionPlansProvider() {
|
||||||
|
_i1.throwOnMissingStub(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<_i4.NutritionalPlan> get items => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#items),
|
||||||
|
returnValue: <_i4.NutritionalPlan>[],
|
||||||
|
) as List<_i4.NutritionalPlan>);
|
||||||
|
@override
|
||||||
|
_i2.AuthProvider get auth => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#auth),
|
||||||
|
returnValue: _FakeAuthProvider_0(
|
||||||
|
this,
|
||||||
|
Invocation.getter(#auth),
|
||||||
|
),
|
||||||
|
) as _i2.AuthProvider);
|
||||||
|
@override
|
||||||
|
set auth(_i2.AuthProvider? _auth) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#auth,
|
||||||
|
_auth,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
_i3.Client get client => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#client),
|
||||||
|
returnValue: _FakeClient_1(
|
||||||
|
this,
|
||||||
|
Invocation.getter(#client),
|
||||||
|
),
|
||||||
|
) as _i3.Client);
|
||||||
|
@override
|
||||||
|
set client(_i3.Client? _client) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#client,
|
||||||
|
_client,
|
||||||
|
),
|
||||||
|
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
|
||||||
|
_i4.NutritionalPlan findById(int? id) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#findById,
|
||||||
|
[id],
|
||||||
|
),
|
||||||
|
returnValue: _FakeNutritionalPlan_2(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#findById,
|
||||||
|
[id],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) as _i4.NutritionalPlan);
|
||||||
|
@override
|
||||||
|
_i5.Meal? findMealById(int? id) => (super.noSuchMethod(Invocation.method(
|
||||||
|
#findMealById,
|
||||||
|
[id],
|
||||||
|
)) as _i5.Meal?);
|
||||||
|
@override
|
||||||
|
_i9.Future<void> fetchAndSetAllPlansSparse() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetAllPlansSparse,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i9.Future<void>.value(),
|
||||||
|
) as _i9.Future<void>);
|
||||||
|
@override
|
||||||
|
_i9.Future<void> fetchAndSetAllPlansFull() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetAllPlansFull,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i9.Future<void>.value(),
|
||||||
|
) as _i9.Future<void>);
|
||||||
|
@override
|
||||||
|
_i9.Future<_i4.NutritionalPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetPlanSparse,
|
||||||
|
[planId],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetPlanSparse,
|
||||||
|
[planId],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i9.Future<_i4.NutritionalPlan>);
|
||||||
|
@override
|
||||||
|
_i9.Future<_i4.NutritionalPlan> fetchAndSetPlanFull(int? planId) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetPlanFull,
|
||||||
|
[planId],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetPlanFull,
|
||||||
|
[planId],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i9.Future<_i4.NutritionalPlan>);
|
||||||
|
@override
|
||||||
|
_i9.Future<_i4.NutritionalPlan> addPlan(_i4.NutritionalPlan? planData) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addPlan,
|
||||||
|
[planData],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#addPlan,
|
||||||
|
[planData],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i9.Future<_i4.NutritionalPlan>);
|
||||||
|
@override
|
||||||
|
_i9.Future<void> editPlan(_i4.NutritionalPlan? plan) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#editPlan,
|
||||||
|
[plan],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i9.Future<void>.value(),
|
||||||
|
) as _i9.Future<void>);
|
||||||
|
@override
|
||||||
|
_i9.Future<void> deletePlan(int? id) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#deletePlan,
|
||||||
|
[id],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i9.Future<void>.value(),
|
||||||
|
) as _i9.Future<void>);
|
||||||
|
@override
|
||||||
|
_i9.Future<_i5.Meal> addMeal(
|
||||||
|
_i5.Meal? meal,
|
||||||
|
int? planId,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addMeal,
|
||||||
|
[
|
||||||
|
meal,
|
||||||
|
planId,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<_i5.Meal>.value(_FakeMeal_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#addMeal,
|
||||||
|
[
|
||||||
|
meal,
|
||||||
|
planId,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i9.Future<_i5.Meal>);
|
||||||
|
@override
|
||||||
|
_i9.Future<_i5.Meal> editMeal(_i5.Meal? meal) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#editMeal,
|
||||||
|
[meal],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<_i5.Meal>.value(_FakeMeal_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#editMeal,
|
||||||
|
[meal],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i9.Future<_i5.Meal>);
|
||||||
|
@override
|
||||||
|
_i9.Future<void> deleteMeal(_i5.Meal? meal) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#deleteMeal,
|
||||||
|
[meal],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i9.Future<void>.value(),
|
||||||
|
) as _i9.Future<void>);
|
||||||
|
@override
|
||||||
|
_i9.Future<_i6.MealItem> addMealItem(
|
||||||
|
_i6.MealItem? mealItem,
|
||||||
|
_i5.Meal? meal,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addMealItem,
|
||||||
|
[
|
||||||
|
mealItem,
|
||||||
|
meal,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<_i6.MealItem>.value(_FakeMealItem_4(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#addMealItem,
|
||||||
|
[
|
||||||
|
mealItem,
|
||||||
|
meal,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i9.Future<_i6.MealItem>);
|
||||||
|
@override
|
||||||
|
_i9.Future<void> deleteMealItem(_i6.MealItem? mealItem) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#deleteMealItem,
|
||||||
|
[mealItem],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i9.Future<void>.value(),
|
||||||
|
) as _i9.Future<void>);
|
||||||
|
@override
|
||||||
|
_i9.Future<_i7.Ingredient> fetchIngredient(int? ingredientId) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchIngredient,
|
||||||
|
[ingredientId],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<_i7.Ingredient>.value(_FakeIngredient_5(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#fetchIngredient,
|
||||||
|
[ingredientId],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i9.Future<_i7.Ingredient>);
|
||||||
|
@override
|
||||||
|
_i9.Future<void> fetchIngredientsFromCache() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchIngredientsFromCache,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i9.Future<void>.value(),
|
||||||
|
) as _i9.Future<void>);
|
||||||
|
@override
|
||||||
|
_i9.Future<List<dynamic>> searchIngredient(
|
||||||
|
String? name, [
|
||||||
|
String? languageCode = r'en',
|
||||||
|
]) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#searchIngredient,
|
||||||
|
[
|
||||||
|
name,
|
||||||
|
languageCode,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<List<dynamic>>.value(<dynamic>[]),
|
||||||
|
) as _i9.Future<List<dynamic>>);
|
||||||
|
@override
|
||||||
|
_i9.Future<_i7.Ingredient?> searchIngredientWithCode(String? code) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#searchIngredientWithCode,
|
||||||
|
[code],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<_i7.Ingredient?>.value(),
|
||||||
|
) as _i9.Future<_i7.Ingredient?>);
|
||||||
|
@override
|
||||||
|
_i9.Future<void> logMealToDiary(_i5.Meal? meal) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#logMealToDiary,
|
||||||
|
[meal],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i9.Future<void>.value(),
|
||||||
|
) as _i9.Future<void>);
|
||||||
|
@override
|
||||||
|
_i9.Future<void> logIngredentToDiary(
|
||||||
|
_i6.MealItem? mealItem,
|
||||||
|
int? planId, [
|
||||||
|
DateTime? dateTime,
|
||||||
|
]) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#logIngredentToDiary,
|
||||||
|
[
|
||||||
|
mealItem,
|
||||||
|
planId,
|
||||||
|
dateTime,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i9.Future<void>.value(),
|
||||||
|
) as _i9.Future<void>);
|
||||||
|
@override
|
||||||
|
_i9.Future<void> deleteLog(
|
||||||
|
int? logId,
|
||||||
|
int? planId,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#deleteLog,
|
||||||
|
[
|
||||||
|
logId,
|
||||||
|
planId,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i9.Future<void>.value(),
|
||||||
|
) as _i9.Future<void>);
|
||||||
|
@override
|
||||||
|
_i9.Future<void> fetchAndSetLogs(_i4.NutritionalPlan? plan) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetLogs,
|
||||||
|
[plan],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i9.Future<void>.value(),
|
||||||
|
) as _i9.Future<void>);
|
||||||
|
@override
|
||||||
|
Map<String, String> getDefaultHeaders({dynamic 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_6(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#makeUrl,
|
||||||
|
[path],
|
||||||
|
{
|
||||||
|
#id: id,
|
||||||
|
#objectMethod: objectMethod,
|
||||||
|
#query: query,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) as Uri);
|
||||||
|
@override
|
||||||
|
_i9.Future<Map<String, dynamic>> fetch(Uri? uri) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetch,
|
||||||
|
[uri],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||||
|
) as _i9.Future<Map<String, dynamic>>);
|
||||||
|
@override
|
||||||
|
_i9.Future<List<dynamic>> fetchPaginated(Uri? uri) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchPaginated,
|
||||||
|
[uri],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<List<dynamic>>.value(<dynamic>[]),
|
||||||
|
) as _i9.Future<List<dynamic>>);
|
||||||
|
@override
|
||||||
|
_i9.Future<Map<String, dynamic>> post(
|
||||||
|
Map<String, dynamic>? data,
|
||||||
|
Uri? uri,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#post,
|
||||||
|
[
|
||||||
|
data,
|
||||||
|
uri,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||||
|
) as _i9.Future<Map<String, dynamic>>);
|
||||||
|
@override
|
||||||
|
_i9.Future<Map<String, dynamic>> patch(
|
||||||
|
Map<String, dynamic>? data,
|
||||||
|
Uri? uri,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#patch,
|
||||||
|
[
|
||||||
|
data,
|
||||||
|
uri,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||||
|
) as _i9.Future<Map<String, dynamic>>);
|
||||||
|
@override
|
||||||
|
_i9.Future<_i3.Response> deleteRequest(
|
||||||
|
String? url,
|
||||||
|
int? id,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#deleteRequest,
|
||||||
|
[
|
||||||
|
url,
|
||||||
|
id,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i9.Future<_i3.Response>.value(_FakeResponse_7(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#deleteRequest,
|
||||||
|
[
|
||||||
|
url,
|
||||||
|
id,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i9.Future<_i3.Response>);
|
||||||
|
@override
|
||||||
|
void addListener(_i10.VoidCallback? listener) => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addListener,
|
||||||
|
[listener],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void removeListener(_i10.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,
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -19,27 +19,33 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:mockito/annotations.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:wger/providers/auth.dart';
|
||||||
|
import 'package:wger/providers/base_provider.dart';
|
||||||
import 'package:wger/providers/body_weight.dart';
|
import 'package:wger/providers/body_weight.dart';
|
||||||
import 'package:wger/providers/nutrition.dart';
|
import 'package:wger/providers/nutrition.dart';
|
||||||
import 'package:wger/screens/nutritional_plan_screen.dart';
|
import 'package:wger/screens/nutritional_plan_screen.dart';
|
||||||
import 'package:wger/widgets/nutrition/charts.dart';
|
import 'package:wger/widgets/nutrition/charts.dart';
|
||||||
|
|
||||||
import '../../test_data/nutritional_plans.dart';
|
import '../../test_data/nutritional_plans.dart';
|
||||||
import '../other/base_provider_test.mocks.dart';
|
import 'nutritional_plan_screen_test.mocks.dart';
|
||||||
import '../utils.dart';
|
|
||||||
|
|
||||||
|
@GenerateMocks([WgerBaseProvider, AuthProvider, http.Client])
|
||||||
void main() {
|
void main() {
|
||||||
Widget createNutritionalPlan({locale = 'en'}) {
|
Widget createNutritionalPlan({locale = 'en'}) {
|
||||||
final key = GlobalKey<NavigatorState>();
|
final key = GlobalKey<NavigatorState>();
|
||||||
final client = MockClient();
|
final client = MockClient();
|
||||||
|
final mockBaseProvider = MockWgerBaseProvider();
|
||||||
|
final mockAuthProvider = MockAuthProvider();
|
||||||
|
|
||||||
final plan = getNutritionalPlan();
|
final plan = getNutritionalPlan();
|
||||||
|
|
||||||
return MultiProvider(
|
return MultiProvider(
|
||||||
providers: [
|
providers: [
|
||||||
ChangeNotifierProvider<NutritionPlansProvider>(
|
ChangeNotifierProvider<NutritionPlansProvider>(
|
||||||
create: (context) => NutritionPlansProvider(testAuthProvider, [], client),
|
create: (context) => NutritionPlansProvider(mockAuthProvider, [], client),
|
||||||
),
|
),
|
||||||
ChangeNotifierProvider<BodyWeightProvider>(
|
ChangeNotifierProvider<BodyWeightProvider>(
|
||||||
create: (context) => BodyWeightProvider(mockBaseProvider),
|
create: (context) => BodyWeightProvider(mockBaseProvider),
|
||||||
|
|||||||
684
test/nutrition/nutritional_plan_screen_test.mocks.dart
Normal file
684
test/nutrition/nutritional_plan_screen_test.mocks.dart
Normal file
@@ -0,0 +1,684 @@
|
|||||||
|
// Mocks generated by Mockito 5.3.2 from annotations
|
||||||
|
// in wger/test/nutrition/nutritional_plan_screen_test.dart.
|
||||||
|
// Do not manually edit this file.
|
||||||
|
|
||||||
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
|
import 'dart:async' as _i5;
|
||||||
|
import 'dart:convert' as _i8;
|
||||||
|
import 'dart:typed_data' as _i9;
|
||||||
|
import 'dart:ui' as _i7;
|
||||||
|
|
||||||
|
import 'package:http/http.dart' as _i3;
|
||||||
|
import 'package:mockito/mockito.dart' as _i1;
|
||||||
|
import 'package:package_info/package_info.dart' as _i6;
|
||||||
|
import 'package:wger/providers/auth.dart' as _i2;
|
||||||
|
import 'package:wger/providers/base_provider.dart' as _i4;
|
||||||
|
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: avoid_redundant_argument_values
|
||||||
|
// ignore_for_file: avoid_setters_without_getters
|
||||||
|
// ignore_for_file: comment_references
|
||||||
|
// ignore_for_file: implementation_imports
|
||||||
|
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
||||||
|
// ignore_for_file: prefer_const_constructors
|
||||||
|
// ignore_for_file: unnecessary_parenthesis
|
||||||
|
// 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 _FakeStreamedResponse_4 extends _i1.SmartFake implements _i3.StreamedResponse {
|
||||||
|
_FakeStreamedResponse_4(
|
||||||
|
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
|
||||||
|
set auth(_i2.AuthProvider? _auth) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#auth,
|
||||||
|
_auth,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
_i3.Client get client => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#client),
|
||||||
|
returnValue: _FakeClient_1(
|
||||||
|
this,
|
||||||
|
Invocation.getter(#client),
|
||||||
|
),
|
||||||
|
) as _i3.Client);
|
||||||
|
@override
|
||||||
|
set client(_i3.Client? _client) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#client,
|
||||||
|
_client,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
Map<String, String> getDefaultHeaders({dynamic 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
|
||||||
|
_i5.Future<Map<String, dynamic>> fetch(Uri? uri) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetch,
|
||||||
|
[uri],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||||
|
) as _i5.Future<Map<String, dynamic>>);
|
||||||
|
@override
|
||||||
|
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchPaginated,
|
||||||
|
[uri],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<List<dynamic>>.value(<dynamic>[]),
|
||||||
|
) as _i5.Future<List<dynamic>>);
|
||||||
|
@override
|
||||||
|
_i5.Future<Map<String, dynamic>> post(
|
||||||
|
Map<String, dynamic>? data,
|
||||||
|
Uri? uri,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#post,
|
||||||
|
[
|
||||||
|
data,
|
||||||
|
uri,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||||
|
) as _i5.Future<Map<String, dynamic>>);
|
||||||
|
@override
|
||||||
|
_i5.Future<Map<String, dynamic>> patch(
|
||||||
|
Map<String, dynamic>? data,
|
||||||
|
Uri? uri,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#patch,
|
||||||
|
[
|
||||||
|
data,
|
||||||
|
uri,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||||
|
) as _i5.Future<Map<String, dynamic>>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i3.Response> deleteRequest(
|
||||||
|
String? url,
|
||||||
|
int? id,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#deleteRequest,
|
||||||
|
[
|
||||||
|
url,
|
||||||
|
id,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#deleteRequest,
|
||||||
|
[
|
||||||
|
url,
|
||||||
|
id,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i3.Response>);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A class which mocks [AuthProvider].
|
||||||
|
///
|
||||||
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
|
class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider {
|
||||||
|
MockAuthProvider() {
|
||||||
|
_i1.throwOnMissingStub(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
set token(String? _token) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#token,
|
||||||
|
_token,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
set serverUrl(String? _serverUrl) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#serverUrl,
|
||||||
|
_serverUrl,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
set serverVersion(String? _serverVersion) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#serverVersion,
|
||||||
|
_serverVersion,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
set applicationVersion(_i6.PackageInfo? _applicationVersion) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#applicationVersion,
|
||||||
|
_applicationVersion,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
Map<String, String> get metadata => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#metadata),
|
||||||
|
returnValue: <String, String>{},
|
||||||
|
) as Map<String, String>);
|
||||||
|
@override
|
||||||
|
set metadata(Map<String, String>? _metadata) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#metadata,
|
||||||
|
_metadata,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
_i3.Client get client => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#client),
|
||||||
|
returnValue: _FakeClient_1(
|
||||||
|
this,
|
||||||
|
Invocation.getter(#client),
|
||||||
|
),
|
||||||
|
) as _i3.Client);
|
||||||
|
@override
|
||||||
|
set client(_i3.Client? _client) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#client,
|
||||||
|
_client,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
bool get dataInit => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#dataInit),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
set dataInit(bool? _dataInit) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#dataInit,
|
||||||
|
_dataInit,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
bool get isAuth => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#isAuth),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
bool get hasListeners => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#hasListeners),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
_i5.Future<void> setServerVersion() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#setServerVersion,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||||
|
) as _i5.Future<void>);
|
||||||
|
@override
|
||||||
|
_i5.Future<void> initData(String? serverUrl) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#initData,
|
||||||
|
[serverUrl],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||||
|
) as _i5.Future<void>);
|
||||||
|
@override
|
||||||
|
_i5.Future<void> setApplicationVersion() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#setApplicationVersion,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||||
|
) as _i5.Future<void>);
|
||||||
|
@override
|
||||||
|
_i5.Future<bool> applicationUpdateRequired([
|
||||||
|
String? version,
|
||||||
|
Map<String, String>? metadata,
|
||||||
|
]) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#applicationUpdateRequired,
|
||||||
|
[
|
||||||
|
version,
|
||||||
|
metadata,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<bool>.value(false),
|
||||||
|
) as _i5.Future<bool>);
|
||||||
|
@override
|
||||||
|
_i5.Future<Map<String, _i2.LoginActions>> register({
|
||||||
|
required String? username,
|
||||||
|
required String? password,
|
||||||
|
required String? email,
|
||||||
|
required String? serverUrl,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#register,
|
||||||
|
[],
|
||||||
|
{
|
||||||
|
#username: username,
|
||||||
|
#password: password,
|
||||||
|
#email: email,
|
||||||
|
#serverUrl: serverUrl,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<Map<String, _i2.LoginActions>>.value(<String, _i2.LoginActions>{}),
|
||||||
|
) as _i5.Future<Map<String, _i2.LoginActions>>);
|
||||||
|
@override
|
||||||
|
_i5.Future<Map<String, _i2.LoginActions>> login(
|
||||||
|
String? username,
|
||||||
|
String? password,
|
||||||
|
String? serverUrl,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#login,
|
||||||
|
[
|
||||||
|
username,
|
||||||
|
password,
|
||||||
|
serverUrl,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<Map<String, _i2.LoginActions>>.value(<String, _i2.LoginActions>{}),
|
||||||
|
) as _i5.Future<Map<String, _i2.LoginActions>>);
|
||||||
|
@override
|
||||||
|
_i5.Future<String> getServerUrlFromPrefs() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#getServerUrlFromPrefs,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<String>.value(''),
|
||||||
|
) as _i5.Future<String>);
|
||||||
|
@override
|
||||||
|
_i5.Future<bool> tryAutoLogin() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#tryAutoLogin,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<bool>.value(false),
|
||||||
|
) as _i5.Future<bool>);
|
||||||
|
@override
|
||||||
|
_i5.Future<void> logout({bool? shouldNotify = true}) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#logout,
|
||||||
|
[],
|
||||||
|
{#shouldNotify: shouldNotify},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||||
|
) as _i5.Future<void>);
|
||||||
|
@override
|
||||||
|
String getAppNameHeader() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#getAppNameHeader,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
void addListener(_i7.VoidCallback? listener) => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addListener,
|
||||||
|
[listener],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void removeListener(_i7.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 [Client].
|
||||||
|
///
|
||||||
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
|
class MockClient extends _i1.Mock implements _i3.Client {
|
||||||
|
MockClient() {
|
||||||
|
_i1.throwOnMissingStub(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
_i5.Future<_i3.Response> head(
|
||||||
|
Uri? url, {
|
||||||
|
Map<String, String>? headers,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#head,
|
||||||
|
[url],
|
||||||
|
{#headers: headers},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#head,
|
||||||
|
[url],
|
||||||
|
{#headers: headers},
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i3.Response>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i3.Response> get(
|
||||||
|
Uri? url, {
|
||||||
|
Map<String, String>? headers,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#get,
|
||||||
|
[url],
|
||||||
|
{#headers: headers},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#get,
|
||||||
|
[url],
|
||||||
|
{#headers: headers},
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i3.Response>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i3.Response> post(
|
||||||
|
Uri? url, {
|
||||||
|
Map<String, String>? headers,
|
||||||
|
Object? body,
|
||||||
|
_i8.Encoding? encoding,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#post,
|
||||||
|
[url],
|
||||||
|
{
|
||||||
|
#headers: headers,
|
||||||
|
#body: body,
|
||||||
|
#encoding: encoding,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#post,
|
||||||
|
[url],
|
||||||
|
{
|
||||||
|
#headers: headers,
|
||||||
|
#body: body,
|
||||||
|
#encoding: encoding,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i3.Response>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i3.Response> put(
|
||||||
|
Uri? url, {
|
||||||
|
Map<String, String>? headers,
|
||||||
|
Object? body,
|
||||||
|
_i8.Encoding? encoding,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#put,
|
||||||
|
[url],
|
||||||
|
{
|
||||||
|
#headers: headers,
|
||||||
|
#body: body,
|
||||||
|
#encoding: encoding,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#put,
|
||||||
|
[url],
|
||||||
|
{
|
||||||
|
#headers: headers,
|
||||||
|
#body: body,
|
||||||
|
#encoding: encoding,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i3.Response>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i3.Response> patch(
|
||||||
|
Uri? url, {
|
||||||
|
Map<String, String>? headers,
|
||||||
|
Object? body,
|
||||||
|
_i8.Encoding? encoding,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#patch,
|
||||||
|
[url],
|
||||||
|
{
|
||||||
|
#headers: headers,
|
||||||
|
#body: body,
|
||||||
|
#encoding: encoding,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#patch,
|
||||||
|
[url],
|
||||||
|
{
|
||||||
|
#headers: headers,
|
||||||
|
#body: body,
|
||||||
|
#encoding: encoding,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i3.Response>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i3.Response> delete(
|
||||||
|
Uri? url, {
|
||||||
|
Map<String, String>? headers,
|
||||||
|
Object? body,
|
||||||
|
_i8.Encoding? encoding,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#delete,
|
||||||
|
[url],
|
||||||
|
{
|
||||||
|
#headers: headers,
|
||||||
|
#body: body,
|
||||||
|
#encoding: encoding,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#delete,
|
||||||
|
[url],
|
||||||
|
{
|
||||||
|
#headers: headers,
|
||||||
|
#body: body,
|
||||||
|
#encoding: encoding,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i3.Response>);
|
||||||
|
@override
|
||||||
|
_i5.Future<String> read(
|
||||||
|
Uri? url, {
|
||||||
|
Map<String, String>? headers,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#read,
|
||||||
|
[url],
|
||||||
|
{#headers: headers},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<String>.value(''),
|
||||||
|
) as _i5.Future<String>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i9.Uint8List> readBytes(
|
||||||
|
Uri? url, {
|
||||||
|
Map<String, String>? headers,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#readBytes,
|
||||||
|
[url],
|
||||||
|
{#headers: headers},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i9.Uint8List>.value(_i9.Uint8List(0)),
|
||||||
|
) as _i5.Future<_i9.Uint8List>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i3.StreamedResponse> send(_i3.BaseRequest? request) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#send,
|
||||||
|
[request],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i3.StreamedResponse>.value(_FakeStreamedResponse_4(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#send,
|
||||||
|
[request],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i3.StreamedResponse>);
|
||||||
|
@override
|
||||||
|
void close() => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#close,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -20,31 +20,47 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:mockito/annotations.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:wger/models/nutrition/nutritional_plan.dart';
|
import 'package:wger/models/nutrition/nutritional_plan.dart';
|
||||||
|
import 'package:wger/providers/auth.dart';
|
||||||
import 'package:wger/providers/nutrition.dart';
|
import 'package:wger/providers/nutrition.dart';
|
||||||
import 'package:wger/screens/form_screen.dart';
|
import 'package:wger/screens/form_screen.dart';
|
||||||
import 'package:wger/screens/nutritional_plans_screen.dart';
|
import 'package:wger/screens/nutritional_plans_screen.dart';
|
||||||
import 'package:wger/widgets/nutrition/forms.dart';
|
import 'package:wger/widgets/nutrition/forms.dart';
|
||||||
|
|
||||||
import '../other/base_provider_test.mocks.dart';
|
import 'nutritional_plan_screen_test.mocks.dart';
|
||||||
import '../utils.dart';
|
|
||||||
|
|
||||||
|
@GenerateMocks([AuthProvider, http.Client])
|
||||||
void main() {
|
void main() {
|
||||||
|
final mockAuthProvider = MockAuthProvider();
|
||||||
|
final client = MockClient();
|
||||||
|
|
||||||
Widget createHomeScreen({locale = 'en'}) {
|
Widget createHomeScreen({locale = 'en'}) {
|
||||||
final client = MockClient();
|
|
||||||
when(client.delete(
|
when(client.delete(
|
||||||
any,
|
any,
|
||||||
headers: anyNamed('headers'),
|
headers: anyNamed('headers'),
|
||||||
)).thenAnswer((_) async => http.Response('', 200));
|
)).thenAnswer((_) async => http.Response('', 200));
|
||||||
|
|
||||||
|
when(mockAuthProvider.token).thenReturn('1234');
|
||||||
|
when(mockAuthProvider.serverUrl).thenReturn('http://localhost');
|
||||||
|
when(mockAuthProvider.getAppNameHeader()).thenReturn('wger app');
|
||||||
|
|
||||||
return ChangeNotifierProvider<NutritionPlansProvider>(
|
return ChangeNotifierProvider<NutritionPlansProvider>(
|
||||||
create: (context) => NutritionPlansProvider(
|
create: (context) => NutritionPlansProvider(
|
||||||
testAuthProvider,
|
mockAuthProvider,
|
||||||
[
|
[
|
||||||
NutritionalPlan(id: 1, description: 'test plan 1', creationDate: DateTime(2021, 01, 01)),
|
NutritionalPlan(
|
||||||
NutritionalPlan(id: 2, description: 'test plan 2', creationDate: DateTime(2021, 01, 10)),
|
id: 1,
|
||||||
|
description: 'test plan 1',
|
||||||
|
creationDate: DateTime(2021, 01, 01),
|
||||||
|
),
|
||||||
|
NutritionalPlan(
|
||||||
|
id: 2,
|
||||||
|
description: 'test plan 2',
|
||||||
|
creationDate: DateTime(2021, 01, 10),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
client,
|
client,
|
||||||
),
|
),
|
||||||
|
|||||||
512
test/nutrition/nutritional_plans_screen_test.mocks.dart
Normal file
512
test/nutrition/nutritional_plans_screen_test.mocks.dart
Normal file
@@ -0,0 +1,512 @@
|
|||||||
|
// Mocks generated by Mockito 5.3.2 from annotations
|
||||||
|
// in wger/test/nutrition/nutritional_plans_screen_test.dart.
|
||||||
|
// Do not manually edit this file.
|
||||||
|
|
||||||
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
|
import 'dart:async' as _i5;
|
||||||
|
import 'dart:convert' as _i7;
|
||||||
|
import 'dart:typed_data' as _i8;
|
||||||
|
import 'dart:ui' as _i6;
|
||||||
|
|
||||||
|
import 'package:http/http.dart' as _i2;
|
||||||
|
import 'package:mockito/mockito.dart' as _i1;
|
||||||
|
import 'package:package_info/package_info.dart' as _i4;
|
||||||
|
import 'package:wger/providers/auth.dart' as _i3;
|
||||||
|
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: avoid_redundant_argument_values
|
||||||
|
// ignore_for_file: avoid_setters_without_getters
|
||||||
|
// ignore_for_file: comment_references
|
||||||
|
// ignore_for_file: implementation_imports
|
||||||
|
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
||||||
|
// ignore_for_file: prefer_const_constructors
|
||||||
|
// ignore_for_file: unnecessary_parenthesis
|
||||||
|
// ignore_for_file: camel_case_types
|
||||||
|
// ignore_for_file: subtype_of_sealed_class
|
||||||
|
|
||||||
|
class _FakeClient_0 extends _i1.SmartFake implements _i2.Client {
|
||||||
|
_FakeClient_0(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeResponse_1 extends _i1.SmartFake implements _i2.Response {
|
||||||
|
_FakeResponse_1(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeStreamedResponse_2 extends _i1.SmartFake implements _i2.StreamedResponse {
|
||||||
|
_FakeStreamedResponse_2(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A class which mocks [AuthProvider].
|
||||||
|
///
|
||||||
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
|
class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider {
|
||||||
|
MockAuthProvider() {
|
||||||
|
_i1.throwOnMissingStub(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
set token(String? _token) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#token,
|
||||||
|
_token,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
set serverUrl(String? _serverUrl) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#serverUrl,
|
||||||
|
_serverUrl,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
set serverVersion(String? _serverVersion) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#serverVersion,
|
||||||
|
_serverVersion,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
set applicationVersion(_i4.PackageInfo? _applicationVersion) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#applicationVersion,
|
||||||
|
_applicationVersion,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
Map<String, String> get metadata => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#metadata),
|
||||||
|
returnValue: <String, String>{},
|
||||||
|
) as Map<String, String>);
|
||||||
|
@override
|
||||||
|
set metadata(Map<String, String>? _metadata) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#metadata,
|
||||||
|
_metadata,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
_i2.Client get client => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#client),
|
||||||
|
returnValue: _FakeClient_0(
|
||||||
|
this,
|
||||||
|
Invocation.getter(#client),
|
||||||
|
),
|
||||||
|
) as _i2.Client);
|
||||||
|
@override
|
||||||
|
set client(_i2.Client? _client) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#client,
|
||||||
|
_client,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
bool get dataInit => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#dataInit),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
set dataInit(bool? _dataInit) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#dataInit,
|
||||||
|
_dataInit,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
bool get isAuth => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#isAuth),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
bool get hasListeners => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#hasListeners),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
_i5.Future<void> setServerVersion() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#setServerVersion,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||||
|
) as _i5.Future<void>);
|
||||||
|
@override
|
||||||
|
_i5.Future<void> initData(String? serverUrl) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#initData,
|
||||||
|
[serverUrl],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||||
|
) as _i5.Future<void>);
|
||||||
|
@override
|
||||||
|
_i5.Future<void> setApplicationVersion() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#setApplicationVersion,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||||
|
) as _i5.Future<void>);
|
||||||
|
@override
|
||||||
|
_i5.Future<bool> applicationUpdateRequired([
|
||||||
|
String? version,
|
||||||
|
Map<String, String>? metadata,
|
||||||
|
]) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#applicationUpdateRequired,
|
||||||
|
[
|
||||||
|
version,
|
||||||
|
metadata,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<bool>.value(false),
|
||||||
|
) as _i5.Future<bool>);
|
||||||
|
@override
|
||||||
|
_i5.Future<Map<String, _i3.LoginActions>> register({
|
||||||
|
required String? username,
|
||||||
|
required String? password,
|
||||||
|
required String? email,
|
||||||
|
required String? serverUrl,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#register,
|
||||||
|
[],
|
||||||
|
{
|
||||||
|
#username: username,
|
||||||
|
#password: password,
|
||||||
|
#email: email,
|
||||||
|
#serverUrl: serverUrl,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<Map<String, _i3.LoginActions>>.value(<String, _i3.LoginActions>{}),
|
||||||
|
) as _i5.Future<Map<String, _i3.LoginActions>>);
|
||||||
|
@override
|
||||||
|
_i5.Future<Map<String, _i3.LoginActions>> login(
|
||||||
|
String? username,
|
||||||
|
String? password,
|
||||||
|
String? serverUrl,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#login,
|
||||||
|
[
|
||||||
|
username,
|
||||||
|
password,
|
||||||
|
serverUrl,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<Map<String, _i3.LoginActions>>.value(<String, _i3.LoginActions>{}),
|
||||||
|
) as _i5.Future<Map<String, _i3.LoginActions>>);
|
||||||
|
@override
|
||||||
|
_i5.Future<String> getServerUrlFromPrefs() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#getServerUrlFromPrefs,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<String>.value(''),
|
||||||
|
) as _i5.Future<String>);
|
||||||
|
@override
|
||||||
|
_i5.Future<bool> tryAutoLogin() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#tryAutoLogin,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<bool>.value(false),
|
||||||
|
) as _i5.Future<bool>);
|
||||||
|
@override
|
||||||
|
_i5.Future<void> logout({bool? shouldNotify = true}) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#logout,
|
||||||
|
[],
|
||||||
|
{#shouldNotify: shouldNotify},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||||
|
) as _i5.Future<void>);
|
||||||
|
@override
|
||||||
|
String getAppNameHeader() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#getAppNameHeader,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
void addListener(_i6.VoidCallback? listener) => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addListener,
|
||||||
|
[listener],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void removeListener(_i6.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 [Client].
|
||||||
|
///
|
||||||
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
|
class MockClient extends _i1.Mock implements _i2.Client {
|
||||||
|
MockClient() {
|
||||||
|
_i1.throwOnMissingStub(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
_i5.Future<_i2.Response> head(
|
||||||
|
Uri? url, {
|
||||||
|
Map<String, String>? headers,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#head,
|
||||||
|
[url],
|
||||||
|
{#headers: headers},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i2.Response>.value(_FakeResponse_1(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#head,
|
||||||
|
[url],
|
||||||
|
{#headers: headers},
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i2.Response>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i2.Response> get(
|
||||||
|
Uri? url, {
|
||||||
|
Map<String, String>? headers,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#get,
|
||||||
|
[url],
|
||||||
|
{#headers: headers},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i2.Response>.value(_FakeResponse_1(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#get,
|
||||||
|
[url],
|
||||||
|
{#headers: headers},
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i2.Response>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i2.Response> post(
|
||||||
|
Uri? url, {
|
||||||
|
Map<String, String>? headers,
|
||||||
|
Object? body,
|
||||||
|
_i7.Encoding? encoding,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#post,
|
||||||
|
[url],
|
||||||
|
{
|
||||||
|
#headers: headers,
|
||||||
|
#body: body,
|
||||||
|
#encoding: encoding,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i2.Response>.value(_FakeResponse_1(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#post,
|
||||||
|
[url],
|
||||||
|
{
|
||||||
|
#headers: headers,
|
||||||
|
#body: body,
|
||||||
|
#encoding: encoding,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i2.Response>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i2.Response> put(
|
||||||
|
Uri? url, {
|
||||||
|
Map<String, String>? headers,
|
||||||
|
Object? body,
|
||||||
|
_i7.Encoding? encoding,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#put,
|
||||||
|
[url],
|
||||||
|
{
|
||||||
|
#headers: headers,
|
||||||
|
#body: body,
|
||||||
|
#encoding: encoding,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i2.Response>.value(_FakeResponse_1(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#put,
|
||||||
|
[url],
|
||||||
|
{
|
||||||
|
#headers: headers,
|
||||||
|
#body: body,
|
||||||
|
#encoding: encoding,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i2.Response>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i2.Response> patch(
|
||||||
|
Uri? url, {
|
||||||
|
Map<String, String>? headers,
|
||||||
|
Object? body,
|
||||||
|
_i7.Encoding? encoding,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#patch,
|
||||||
|
[url],
|
||||||
|
{
|
||||||
|
#headers: headers,
|
||||||
|
#body: body,
|
||||||
|
#encoding: encoding,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i2.Response>.value(_FakeResponse_1(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#patch,
|
||||||
|
[url],
|
||||||
|
{
|
||||||
|
#headers: headers,
|
||||||
|
#body: body,
|
||||||
|
#encoding: encoding,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i2.Response>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i2.Response> delete(
|
||||||
|
Uri? url, {
|
||||||
|
Map<String, String>? headers,
|
||||||
|
Object? body,
|
||||||
|
_i7.Encoding? encoding,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#delete,
|
||||||
|
[url],
|
||||||
|
{
|
||||||
|
#headers: headers,
|
||||||
|
#body: body,
|
||||||
|
#encoding: encoding,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i2.Response>.value(_FakeResponse_1(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#delete,
|
||||||
|
[url],
|
||||||
|
{
|
||||||
|
#headers: headers,
|
||||||
|
#body: body,
|
||||||
|
#encoding: encoding,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i2.Response>);
|
||||||
|
@override
|
||||||
|
_i5.Future<String> read(
|
||||||
|
Uri? url, {
|
||||||
|
Map<String, String>? headers,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#read,
|
||||||
|
[url],
|
||||||
|
{#headers: headers},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<String>.value(''),
|
||||||
|
) as _i5.Future<String>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i8.Uint8List> readBytes(
|
||||||
|
Uri? url, {
|
||||||
|
Map<String, String>? headers,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#readBytes,
|
||||||
|
[url],
|
||||||
|
{#headers: headers},
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i8.Uint8List>.value(_i8.Uint8List(0)),
|
||||||
|
) as _i5.Future<_i8.Uint8List>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#send,
|
||||||
|
[request],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i2.StreamedResponse>.value(_FakeStreamedResponse_2(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#send,
|
||||||
|
[request],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i2.StreamedResponse>);
|
||||||
|
@override
|
||||||
|
void close() => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#close,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -20,14 +20,23 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
|
import 'package:mockito/annotations.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:wger/models/body_weight/weight_entry.dart';
|
import 'package:wger/models/body_weight/weight_entry.dart';
|
||||||
|
import 'package:wger/providers/base_provider.dart';
|
||||||
import 'package:wger/providers/body_weight.dart';
|
import 'package:wger/providers/body_weight.dart';
|
||||||
|
|
||||||
import '../fixtures/fixture_reader.dart';
|
import '../fixtures/fixture_reader.dart';
|
||||||
import '../utils.dart';
|
import 'weight_provider_test.mocks.dart';
|
||||||
|
|
||||||
|
@GenerateMocks([WgerBaseProvider])
|
||||||
void main() {
|
void main() {
|
||||||
|
var mockBaseProvider = MockWgerBaseProvider();
|
||||||
|
|
||||||
|
setUp(() {
|
||||||
|
mockBaseProvider = MockWgerBaseProvider();
|
||||||
|
});
|
||||||
|
|
||||||
group('test body weight provider', () {
|
group('test body weight provider', () {
|
||||||
test('Test that the weight entries are correctly loaded', () async {
|
test('Test that the weight entries are correctly loaded', () async {
|
||||||
final uri = Uri(
|
final uri = Uri(
|
||||||
|
|||||||
213
test/weight/weight_provider_test.mocks.dart
Normal file
213
test/weight/weight_provider_test.mocks.dart
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
// Mocks generated by Mockito 5.3.2 from annotations
|
||||||
|
// in wger/test/weight/weight_provider_test.dart.
|
||||||
|
// Do not manually edit this file.
|
||||||
|
|
||||||
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
|
import 'dart:async' as _i5;
|
||||||
|
|
||||||
|
import 'package:http/http.dart' as _i3;
|
||||||
|
import 'package:mockito/mockito.dart' as _i1;
|
||||||
|
import 'package:wger/providers/auth.dart' as _i2;
|
||||||
|
import 'package:wger/providers/base_provider.dart' as _i4;
|
||||||
|
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: avoid_redundant_argument_values
|
||||||
|
// ignore_for_file: avoid_setters_without_getters
|
||||||
|
// ignore_for_file: comment_references
|
||||||
|
// ignore_for_file: implementation_imports
|
||||||
|
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
||||||
|
// ignore_for_file: prefer_const_constructors
|
||||||
|
// ignore_for_file: unnecessary_parenthesis
|
||||||
|
// 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,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 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
|
||||||
|
set auth(_i2.AuthProvider? _auth) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#auth,
|
||||||
|
_auth,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
_i3.Client get client => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#client),
|
||||||
|
returnValue: _FakeClient_1(
|
||||||
|
this,
|
||||||
|
Invocation.getter(#client),
|
||||||
|
),
|
||||||
|
) as _i3.Client);
|
||||||
|
@override
|
||||||
|
set client(_i3.Client? _client) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#client,
|
||||||
|
_client,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
Map<String, String> getDefaultHeaders({dynamic 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
|
||||||
|
_i5.Future<Map<String, dynamic>> fetch(Uri? uri) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetch,
|
||||||
|
[uri],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||||
|
) as _i5.Future<Map<String, dynamic>>);
|
||||||
|
@override
|
||||||
|
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchPaginated,
|
||||||
|
[uri],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<List<dynamic>>.value(<dynamic>[]),
|
||||||
|
) as _i5.Future<List<dynamic>>);
|
||||||
|
@override
|
||||||
|
_i5.Future<Map<String, dynamic>> post(
|
||||||
|
Map<String, dynamic>? data,
|
||||||
|
Uri? uri,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#post,
|
||||||
|
[
|
||||||
|
data,
|
||||||
|
uri,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||||
|
) as _i5.Future<Map<String, dynamic>>);
|
||||||
|
@override
|
||||||
|
_i5.Future<Map<String, dynamic>> patch(
|
||||||
|
Map<String, dynamic>? data,
|
||||||
|
Uri? uri,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#patch,
|
||||||
|
[
|
||||||
|
data,
|
||||||
|
uri,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||||
|
) as _i5.Future<Map<String, dynamic>>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i3.Response> deleteRequest(
|
||||||
|
String? url,
|
||||||
|
int? id,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#deleteRequest,
|
||||||
|
[
|
||||||
|
url,
|
||||||
|
id,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#deleteRequest,
|
||||||
|
[
|
||||||
|
url,
|
||||||
|
id,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i3.Response>);
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:mockito/annotations.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:wger/providers/body_weight.dart';
|
import 'package:wger/providers/body_weight.dart';
|
||||||
@@ -28,10 +29,11 @@ import 'package:wger/widgets/core/charts.dart';
|
|||||||
import 'package:wger/widgets/weight/forms.dart';
|
import 'package:wger/widgets/weight/forms.dart';
|
||||||
|
|
||||||
import '../../test_data/body_weight.dart';
|
import '../../test_data/body_weight.dart';
|
||||||
import '../workout/weight_unit_form_widget_test.mocks.dart';
|
import 'weight_screen_test.mocks.dart';
|
||||||
|
|
||||||
|
@GenerateMocks([BodyWeightProvider])
|
||||||
void main() {
|
void main() {
|
||||||
MockBodyWeightProvider mockWeightProvider = MockBodyWeightProvider();
|
var mockWeightProvider = MockBodyWeightProvider();
|
||||||
|
|
||||||
Widget createWeightScreen({locale = 'en'}) {
|
Widget createWeightScreen({locale = 'en'}) {
|
||||||
mockWeightProvider = MockBodyWeightProvider();
|
mockWeightProvider = MockBodyWeightProvider();
|
||||||
|
|||||||
178
test/weight/weight_screen_test.mocks.dart
Normal file
178
test/weight/weight_screen_test.mocks.dart
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
// Mocks generated by Mockito 5.3.2 from annotations
|
||||||
|
// in wger/test/weight/weight_screen_test.dart.
|
||||||
|
// Do not manually edit this file.
|
||||||
|
|
||||||
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
|
import 'dart:async' as _i5;
|
||||||
|
import 'dart:ui' as _i6;
|
||||||
|
|
||||||
|
import 'package:mockito/mockito.dart' as _i1;
|
||||||
|
import 'package:wger/models/body_weight/weight_entry.dart' as _i3;
|
||||||
|
import 'package:wger/providers/base_provider.dart' as _i2;
|
||||||
|
import 'package:wger/providers/body_weight.dart' as _i4;
|
||||||
|
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: avoid_redundant_argument_values
|
||||||
|
// ignore_for_file: avoid_setters_without_getters
|
||||||
|
// ignore_for_file: comment_references
|
||||||
|
// ignore_for_file: implementation_imports
|
||||||
|
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
||||||
|
// ignore_for_file: prefer_const_constructors
|
||||||
|
// ignore_for_file: unnecessary_parenthesis
|
||||||
|
// ignore_for_file: camel_case_types
|
||||||
|
// ignore_for_file: subtype_of_sealed_class
|
||||||
|
|
||||||
|
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
|
||||||
|
_FakeWgerBaseProvider_0(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeWeightEntry_1 extends _i1.SmartFake implements _i3.WeightEntry {
|
||||||
|
_FakeWeightEntry_1(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A class which mocks [BodyWeightProvider].
|
||||||
|
///
|
||||||
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
|
class MockBodyWeightProvider extends _i1.Mock implements _i4.BodyWeightProvider {
|
||||||
|
MockBodyWeightProvider() {
|
||||||
|
_i1.throwOnMissingStub(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
_i2.WgerBaseProvider get baseProvider => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#baseProvider),
|
||||||
|
returnValue: _FakeWgerBaseProvider_0(
|
||||||
|
this,
|
||||||
|
Invocation.getter(#baseProvider),
|
||||||
|
),
|
||||||
|
) as _i2.WgerBaseProvider);
|
||||||
|
@override
|
||||||
|
List<_i3.WeightEntry> get items => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#items),
|
||||||
|
returnValue: <_i3.WeightEntry>[],
|
||||||
|
) as List<_i3.WeightEntry>);
|
||||||
|
@override
|
||||||
|
set items(List<_i3.WeightEntry>? entries) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#items,
|
||||||
|
entries,
|
||||||
|
),
|
||||||
|
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
|
||||||
|
_i3.WeightEntry findById(int? id) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#findById,
|
||||||
|
[id],
|
||||||
|
),
|
||||||
|
returnValue: _FakeWeightEntry_1(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#findById,
|
||||||
|
[id],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) as _i3.WeightEntry);
|
||||||
|
@override
|
||||||
|
_i3.WeightEntry? findByDate(DateTime? date) => (super.noSuchMethod(Invocation.method(
|
||||||
|
#findByDate,
|
||||||
|
[date],
|
||||||
|
)) as _i3.WeightEntry?);
|
||||||
|
@override
|
||||||
|
_i5.Future<List<_i3.WeightEntry>> fetchAndSetEntries() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetEntries,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<List<_i3.WeightEntry>>.value(<_i3.WeightEntry>[]),
|
||||||
|
) as _i5.Future<List<_i3.WeightEntry>>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i3.WeightEntry> addEntry(_i3.WeightEntry? entry) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addEntry,
|
||||||
|
[entry],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i3.WeightEntry>.value(_FakeWeightEntry_1(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#addEntry,
|
||||||
|
[entry],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i3.WeightEntry>);
|
||||||
|
@override
|
||||||
|
_i5.Future<void> editEntry(_i3.WeightEntry? entry) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#editEntry,
|
||||||
|
[entry],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||||
|
) as _i5.Future<void>);
|
||||||
|
@override
|
||||||
|
_i5.Future<void> deleteEntry(int? id) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#deleteEntry,
|
||||||
|
[id],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||||
|
) as _i5.Future<void>);
|
||||||
|
@override
|
||||||
|
void addListener(_i6.VoidCallback? listener) => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addListener,
|
||||||
|
[listener],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void removeListener(_i6.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,
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:mockito/annotations.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:wger/models/workouts/repetition_unit.dart';
|
import 'package:wger/models/workouts/repetition_unit.dart';
|
||||||
@@ -27,8 +28,9 @@ import 'package:wger/providers/workout_plans.dart';
|
|||||||
import 'package:wger/screens/workout_plan_screen.dart';
|
import 'package:wger/screens/workout_plan_screen.dart';
|
||||||
import 'package:wger/widgets/workouts/forms.dart';
|
import 'package:wger/widgets/workouts/forms.dart';
|
||||||
|
|
||||||
import './workout_form_test.mocks.dart';
|
import 'repetition_unit_form_widget_test.mocks.dart';
|
||||||
|
|
||||||
|
@GenerateMocks([WorkoutPlansProvider])
|
||||||
void main() {
|
void main() {
|
||||||
var mockWorkoutPlans = MockWorkoutPlansProvider();
|
var mockWorkoutPlans = MockWorkoutPlansProvider();
|
||||||
|
|
||||||
|
|||||||
554
test/workout/repetition_unit_form_widget_test.mocks.dart
Normal file
554
test/workout/repetition_unit_form_widget_test.mocks.dart
Normal file
@@ -0,0 +1,554 @@
|
|||||||
|
// Mocks generated by Mockito 5.3.2 from annotations
|
||||||
|
// in wger/test/workout/repetition_unit_form_widget_test.dart.
|
||||||
|
// Do not manually edit this file.
|
||||||
|
|
||||||
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
|
import 'dart:async' as _i12;
|
||||||
|
import 'dart:ui' as _i15;
|
||||||
|
|
||||||
|
import 'package:mockito/mockito.dart' as _i1;
|
||||||
|
import 'package:wger/models/exercises/base.dart' as _i13;
|
||||||
|
import 'package:wger/models/exercises/translation.dart' as _i14;
|
||||||
|
import 'package:wger/models/workouts/day.dart' as _i6;
|
||||||
|
import 'package:wger/models/workouts/log.dart' as _i10;
|
||||||
|
import 'package:wger/models/workouts/repetition_unit.dart' as _i4;
|
||||||
|
import 'package:wger/models/workouts/session.dart' as _i9;
|
||||||
|
import 'package:wger/models/workouts/set.dart' as _i7;
|
||||||
|
import 'package:wger/models/workouts/setting.dart' as _i8;
|
||||||
|
import 'package:wger/models/workouts/weight_unit.dart' as _i3;
|
||||||
|
import 'package:wger/models/workouts/workout_plan.dart' as _i5;
|
||||||
|
import 'package:wger/providers/base_provider.dart' as _i2;
|
||||||
|
import 'package:wger/providers/workout_plans.dart' as _i11;
|
||||||
|
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: avoid_redundant_argument_values
|
||||||
|
// ignore_for_file: avoid_setters_without_getters
|
||||||
|
// ignore_for_file: comment_references
|
||||||
|
// ignore_for_file: implementation_imports
|
||||||
|
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
||||||
|
// ignore_for_file: prefer_const_constructors
|
||||||
|
// ignore_for_file: unnecessary_parenthesis
|
||||||
|
// ignore_for_file: camel_case_types
|
||||||
|
// ignore_for_file: subtype_of_sealed_class
|
||||||
|
|
||||||
|
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
|
||||||
|
_FakeWgerBaseProvider_0(
|
||||||
|
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_2 extends _i1.SmartFake implements _i4.RepetitionUnit {
|
||||||
|
_FakeRepetitionUnit_2(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeWorkoutPlan_3 extends _i1.SmartFake implements _i5.WorkoutPlan {
|
||||||
|
_FakeWorkoutPlan_3(
|
||||||
|
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 _FakeSet_5 extends _i1.SmartFake implements _i7.Set {
|
||||||
|
_FakeSet_5(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeSetting_6 extends _i1.SmartFake implements _i8.Setting {
|
||||||
|
_FakeSetting_6(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeWorkoutSession_7 extends _i1.SmartFake implements _i9.WorkoutSession {
|
||||||
|
_FakeWorkoutSession_7(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeLog_8 extends _i1.SmartFake implements _i10.Log {
|
||||||
|
_FakeLog_8(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A class which mocks [WorkoutPlansProvider].
|
||||||
|
///
|
||||||
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
|
class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProvider {
|
||||||
|
MockWorkoutPlansProvider() {
|
||||||
|
_i1.throwOnMissingStub(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
_i2.WgerBaseProvider get baseProvider => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#baseProvider),
|
||||||
|
returnValue: _FakeWgerBaseProvider_0(
|
||||||
|
this,
|
||||||
|
Invocation.getter(#baseProvider),
|
||||||
|
),
|
||||||
|
) as _i2.WgerBaseProvider);
|
||||||
|
@override
|
||||||
|
List<_i5.WorkoutPlan> get items => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#items),
|
||||||
|
returnValue: <_i5.WorkoutPlan>[],
|
||||||
|
) as List<_i5.WorkoutPlan>);
|
||||||
|
@override
|
||||||
|
List<_i3.WeightUnit> get weightUnits => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#weightUnits),
|
||||||
|
returnValue: <_i3.WeightUnit>[],
|
||||||
|
) as List<_i3.WeightUnit>);
|
||||||
|
@override
|
||||||
|
_i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#defaultWeightUnit),
|
||||||
|
returnValue: _FakeWeightUnit_1(
|
||||||
|
this,
|
||||||
|
Invocation.getter(#defaultWeightUnit),
|
||||||
|
),
|
||||||
|
) as _i3.WeightUnit);
|
||||||
|
@override
|
||||||
|
List<_i4.RepetitionUnit> get repetitionUnits => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#repetitionUnits),
|
||||||
|
returnValue: <_i4.RepetitionUnit>[],
|
||||||
|
) as List<_i4.RepetitionUnit>);
|
||||||
|
@override
|
||||||
|
_i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#defaultRepetitionUnit),
|
||||||
|
returnValue: _FakeRepetitionUnit_2(
|
||||||
|
this,
|
||||||
|
Invocation.getter(#defaultRepetitionUnit),
|
||||||
|
),
|
||||||
|
) as _i4.RepetitionUnit);
|
||||||
|
@override
|
||||||
|
bool get hasListeners => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#hasListeners),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
void clear() => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#clear,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
List<_i5.WorkoutPlan> getPlans() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#getPlans,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: <_i5.WorkoutPlan>[],
|
||||||
|
) as List<_i5.WorkoutPlan>);
|
||||||
|
@override
|
||||||
|
_i5.WorkoutPlan findById(int? id) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#findById,
|
||||||
|
[id],
|
||||||
|
),
|
||||||
|
returnValue: _FakeWorkoutPlan_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#findById,
|
||||||
|
[id],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) as _i5.WorkoutPlan);
|
||||||
|
@override
|
||||||
|
int findIndexById(int? id) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#findIndexById,
|
||||||
|
[id],
|
||||||
|
),
|
||||||
|
returnValue: 0,
|
||||||
|
) as int);
|
||||||
|
@override
|
||||||
|
void setCurrentPlan(int? id) => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#setCurrentPlan,
|
||||||
|
[id],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void resetCurrentPlan() => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#resetCurrentPlan,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> fetchAndSetAllPlansFull() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetAllPlansFull,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> fetchAndSetAllPlansSparse() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetAllPlansSparse,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<_i5.WorkoutPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetPlanSparse,
|
||||||
|
[planId],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<_i5.WorkoutPlan>.value(_FakeWorkoutPlan_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetPlanSparse,
|
||||||
|
[planId],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i12.Future<_i5.WorkoutPlan>);
|
||||||
|
@override
|
||||||
|
_i12.Future<_i5.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetWorkoutPlanFull,
|
||||||
|
[workoutId],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<_i5.WorkoutPlan>.value(_FakeWorkoutPlan_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetWorkoutPlanFull,
|
||||||
|
[workoutId],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i12.Future<_i5.WorkoutPlan>);
|
||||||
|
@override
|
||||||
|
_i12.Future<_i5.WorkoutPlan> addWorkout(_i5.WorkoutPlan? workout) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addWorkout,
|
||||||
|
[workout],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<_i5.WorkoutPlan>.value(_FakeWorkoutPlan_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#addWorkout,
|
||||||
|
[workout],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i12.Future<_i5.WorkoutPlan>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> editWorkout(_i5.WorkoutPlan? workout) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#editWorkout,
|
||||||
|
[workout],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> deleteWorkout(int? id) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#deleteWorkout,
|
||||||
|
[id],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<Map<String, dynamic>> fetchLogData(
|
||||||
|
_i5.WorkoutPlan? workout,
|
||||||
|
_i13.ExerciseBase? base,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchLogData,
|
||||||
|
[
|
||||||
|
workout,
|
||||||
|
base,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||||
|
) as _i12.Future<Map<String, dynamic>>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> fetchAndSetRepetitionUnits() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetRepetitionUnits,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> fetchAndSetWeightUnits() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetWeightUnits,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> fetchAndSetUnits() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetUnits,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<_i6.Day> addDay(
|
||||||
|
_i6.Day? day,
|
||||||
|
_i5.WorkoutPlan? workout,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addDay,
|
||||||
|
[
|
||||||
|
day,
|
||||||
|
workout,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<_i6.Day>.value(_FakeDay_4(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#addDay,
|
||||||
|
[
|
||||||
|
day,
|
||||||
|
workout,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i12.Future<_i6.Day>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> editDay(_i6.Day? day) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#editDay,
|
||||||
|
[day],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> deleteDay(_i6.Day? day) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#deleteDay,
|
||||||
|
[day],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<_i7.Set> addSet(_i7.Set? workoutSet) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addSet,
|
||||||
|
[workoutSet],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<_i7.Set>.value(_FakeSet_5(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#addSet,
|
||||||
|
[workoutSet],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i12.Future<_i7.Set>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> editSet(_i7.Set? workoutSet) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#editSet,
|
||||||
|
[workoutSet],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<List<_i7.Set>> reorderSets(
|
||||||
|
List<_i7.Set>? sets,
|
||||||
|
int? startIndex,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#reorderSets,
|
||||||
|
[
|
||||||
|
sets,
|
||||||
|
startIndex,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<List<_i7.Set>>.value(<_i7.Set>[]),
|
||||||
|
) as _i12.Future<List<_i7.Set>>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> fetchComputedSettings(_i7.Set? workoutSet) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchComputedSettings,
|
||||||
|
[workoutSet],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<String> fetchSmartText(
|
||||||
|
_i7.Set? workoutSet,
|
||||||
|
_i14.Translation? exercise,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchSmartText,
|
||||||
|
[
|
||||||
|
workoutSet,
|
||||||
|
exercise,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<String>.value(''),
|
||||||
|
) as _i12.Future<String>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> deleteSet(_i7.Set? workoutSet) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#deleteSet,
|
||||||
|
[workoutSet],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<_i8.Setting> addSetting(_i8.Setting? workoutSetting) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addSetting,
|
||||||
|
[workoutSetting],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<_i8.Setting>.value(_FakeSetting_6(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#addSetting,
|
||||||
|
[workoutSetting],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i12.Future<_i8.Setting>);
|
||||||
|
@override
|
||||||
|
_i12.Future<dynamic> fetchSessionData() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchSessionData,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<dynamic>.value(),
|
||||||
|
) as _i12.Future<dynamic>);
|
||||||
|
@override
|
||||||
|
_i12.Future<_i9.WorkoutSession> addSession(_i9.WorkoutSession? session) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addSession,
|
||||||
|
[session],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<_i9.WorkoutSession>.value(_FakeWorkoutSession_7(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#addSession,
|
||||||
|
[session],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i12.Future<_i9.WorkoutSession>);
|
||||||
|
@override
|
||||||
|
_i12.Future<_i10.Log> addLog(_i10.Log? log) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addLog,
|
||||||
|
[log],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<_i10.Log>.value(_FakeLog_8(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#addLog,
|
||||||
|
[log],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i12.Future<_i10.Log>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> deleteLog(_i10.Log? log) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#deleteLog,
|
||||||
|
[log],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
void addListener(_i15.VoidCallback? listener) => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addListener,
|
||||||
|
[listener],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void removeListener(_i15.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,
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:mockito/annotations.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:wger/helpers/consts.dart';
|
import 'package:wger/helpers/consts.dart';
|
||||||
@@ -27,9 +28,10 @@ import 'package:wger/models/workouts/workout_plan.dart';
|
|||||||
import 'package:wger/providers/workout_plans.dart';
|
import 'package:wger/providers/workout_plans.dart';
|
||||||
import 'package:wger/widgets/workouts/forms.dart';
|
import 'package:wger/widgets/workouts/forms.dart';
|
||||||
|
|
||||||
import './workout_form_test.mocks.dart';
|
|
||||||
import '../../test_data/workouts.dart';
|
import '../../test_data/workouts.dart';
|
||||||
|
import 'workout_day_form_test.mocks.dart';
|
||||||
|
|
||||||
|
@GenerateMocks([WorkoutPlansProvider])
|
||||||
void main() {
|
void main() {
|
||||||
var mockWorkoutPlans = MockWorkoutPlansProvider();
|
var mockWorkoutPlans = MockWorkoutPlansProvider();
|
||||||
WorkoutPlan workoutPlan = WorkoutPlan.empty();
|
WorkoutPlan workoutPlan = WorkoutPlan.empty();
|
||||||
|
|||||||
554
test/workout/workout_day_form_test.mocks.dart
Normal file
554
test/workout/workout_day_form_test.mocks.dart
Normal file
@@ -0,0 +1,554 @@
|
|||||||
|
// Mocks generated by Mockito 5.3.2 from annotations
|
||||||
|
// in wger/test/workout/workout_day_form_test.dart.
|
||||||
|
// Do not manually edit this file.
|
||||||
|
|
||||||
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
|
import 'dart:async' as _i12;
|
||||||
|
import 'dart:ui' as _i15;
|
||||||
|
|
||||||
|
import 'package:mockito/mockito.dart' as _i1;
|
||||||
|
import 'package:wger/models/exercises/base.dart' as _i13;
|
||||||
|
import 'package:wger/models/exercises/translation.dart' as _i14;
|
||||||
|
import 'package:wger/models/workouts/day.dart' as _i6;
|
||||||
|
import 'package:wger/models/workouts/log.dart' as _i10;
|
||||||
|
import 'package:wger/models/workouts/repetition_unit.dart' as _i4;
|
||||||
|
import 'package:wger/models/workouts/session.dart' as _i9;
|
||||||
|
import 'package:wger/models/workouts/set.dart' as _i7;
|
||||||
|
import 'package:wger/models/workouts/setting.dart' as _i8;
|
||||||
|
import 'package:wger/models/workouts/weight_unit.dart' as _i3;
|
||||||
|
import 'package:wger/models/workouts/workout_plan.dart' as _i5;
|
||||||
|
import 'package:wger/providers/base_provider.dart' as _i2;
|
||||||
|
import 'package:wger/providers/workout_plans.dart' as _i11;
|
||||||
|
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: avoid_redundant_argument_values
|
||||||
|
// ignore_for_file: avoid_setters_without_getters
|
||||||
|
// ignore_for_file: comment_references
|
||||||
|
// ignore_for_file: implementation_imports
|
||||||
|
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
||||||
|
// ignore_for_file: prefer_const_constructors
|
||||||
|
// ignore_for_file: unnecessary_parenthesis
|
||||||
|
// ignore_for_file: camel_case_types
|
||||||
|
// ignore_for_file: subtype_of_sealed_class
|
||||||
|
|
||||||
|
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
|
||||||
|
_FakeWgerBaseProvider_0(
|
||||||
|
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_2 extends _i1.SmartFake implements _i4.RepetitionUnit {
|
||||||
|
_FakeRepetitionUnit_2(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeWorkoutPlan_3 extends _i1.SmartFake implements _i5.WorkoutPlan {
|
||||||
|
_FakeWorkoutPlan_3(
|
||||||
|
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 _FakeSet_5 extends _i1.SmartFake implements _i7.Set {
|
||||||
|
_FakeSet_5(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeSetting_6 extends _i1.SmartFake implements _i8.Setting {
|
||||||
|
_FakeSetting_6(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeWorkoutSession_7 extends _i1.SmartFake implements _i9.WorkoutSession {
|
||||||
|
_FakeWorkoutSession_7(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeLog_8 extends _i1.SmartFake implements _i10.Log {
|
||||||
|
_FakeLog_8(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A class which mocks [WorkoutPlansProvider].
|
||||||
|
///
|
||||||
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
|
class MockWorkoutPlansProvider extends _i1.Mock implements _i11.WorkoutPlansProvider {
|
||||||
|
MockWorkoutPlansProvider() {
|
||||||
|
_i1.throwOnMissingStub(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
_i2.WgerBaseProvider get baseProvider => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#baseProvider),
|
||||||
|
returnValue: _FakeWgerBaseProvider_0(
|
||||||
|
this,
|
||||||
|
Invocation.getter(#baseProvider),
|
||||||
|
),
|
||||||
|
) as _i2.WgerBaseProvider);
|
||||||
|
@override
|
||||||
|
List<_i5.WorkoutPlan> get items => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#items),
|
||||||
|
returnValue: <_i5.WorkoutPlan>[],
|
||||||
|
) as List<_i5.WorkoutPlan>);
|
||||||
|
@override
|
||||||
|
List<_i3.WeightUnit> get weightUnits => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#weightUnits),
|
||||||
|
returnValue: <_i3.WeightUnit>[],
|
||||||
|
) as List<_i3.WeightUnit>);
|
||||||
|
@override
|
||||||
|
_i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#defaultWeightUnit),
|
||||||
|
returnValue: _FakeWeightUnit_1(
|
||||||
|
this,
|
||||||
|
Invocation.getter(#defaultWeightUnit),
|
||||||
|
),
|
||||||
|
) as _i3.WeightUnit);
|
||||||
|
@override
|
||||||
|
List<_i4.RepetitionUnit> get repetitionUnits => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#repetitionUnits),
|
||||||
|
returnValue: <_i4.RepetitionUnit>[],
|
||||||
|
) as List<_i4.RepetitionUnit>);
|
||||||
|
@override
|
||||||
|
_i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#defaultRepetitionUnit),
|
||||||
|
returnValue: _FakeRepetitionUnit_2(
|
||||||
|
this,
|
||||||
|
Invocation.getter(#defaultRepetitionUnit),
|
||||||
|
),
|
||||||
|
) as _i4.RepetitionUnit);
|
||||||
|
@override
|
||||||
|
bool get hasListeners => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#hasListeners),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
void clear() => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#clear,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
List<_i5.WorkoutPlan> getPlans() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#getPlans,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: <_i5.WorkoutPlan>[],
|
||||||
|
) as List<_i5.WorkoutPlan>);
|
||||||
|
@override
|
||||||
|
_i5.WorkoutPlan findById(int? id) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#findById,
|
||||||
|
[id],
|
||||||
|
),
|
||||||
|
returnValue: _FakeWorkoutPlan_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#findById,
|
||||||
|
[id],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) as _i5.WorkoutPlan);
|
||||||
|
@override
|
||||||
|
int findIndexById(int? id) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#findIndexById,
|
||||||
|
[id],
|
||||||
|
),
|
||||||
|
returnValue: 0,
|
||||||
|
) as int);
|
||||||
|
@override
|
||||||
|
void setCurrentPlan(int? id) => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#setCurrentPlan,
|
||||||
|
[id],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void resetCurrentPlan() => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#resetCurrentPlan,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> fetchAndSetAllPlansFull() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetAllPlansFull,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> fetchAndSetAllPlansSparse() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetAllPlansSparse,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<_i5.WorkoutPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetPlanSparse,
|
||||||
|
[planId],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<_i5.WorkoutPlan>.value(_FakeWorkoutPlan_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetPlanSparse,
|
||||||
|
[planId],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i12.Future<_i5.WorkoutPlan>);
|
||||||
|
@override
|
||||||
|
_i12.Future<_i5.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetWorkoutPlanFull,
|
||||||
|
[workoutId],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<_i5.WorkoutPlan>.value(_FakeWorkoutPlan_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetWorkoutPlanFull,
|
||||||
|
[workoutId],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i12.Future<_i5.WorkoutPlan>);
|
||||||
|
@override
|
||||||
|
_i12.Future<_i5.WorkoutPlan> addWorkout(_i5.WorkoutPlan? workout) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addWorkout,
|
||||||
|
[workout],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<_i5.WorkoutPlan>.value(_FakeWorkoutPlan_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#addWorkout,
|
||||||
|
[workout],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i12.Future<_i5.WorkoutPlan>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> editWorkout(_i5.WorkoutPlan? workout) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#editWorkout,
|
||||||
|
[workout],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> deleteWorkout(int? id) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#deleteWorkout,
|
||||||
|
[id],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<Map<String, dynamic>> fetchLogData(
|
||||||
|
_i5.WorkoutPlan? workout,
|
||||||
|
_i13.ExerciseBase? base,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchLogData,
|
||||||
|
[
|
||||||
|
workout,
|
||||||
|
base,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||||
|
) as _i12.Future<Map<String, dynamic>>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> fetchAndSetRepetitionUnits() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetRepetitionUnits,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> fetchAndSetWeightUnits() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetWeightUnits,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> fetchAndSetUnits() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchAndSetUnits,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<_i6.Day> addDay(
|
||||||
|
_i6.Day? day,
|
||||||
|
_i5.WorkoutPlan? workout,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addDay,
|
||||||
|
[
|
||||||
|
day,
|
||||||
|
workout,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<_i6.Day>.value(_FakeDay_4(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#addDay,
|
||||||
|
[
|
||||||
|
day,
|
||||||
|
workout,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i12.Future<_i6.Day>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> editDay(_i6.Day? day) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#editDay,
|
||||||
|
[day],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> deleteDay(_i6.Day? day) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#deleteDay,
|
||||||
|
[day],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<_i7.Set> addSet(_i7.Set? workoutSet) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addSet,
|
||||||
|
[workoutSet],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<_i7.Set>.value(_FakeSet_5(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#addSet,
|
||||||
|
[workoutSet],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i12.Future<_i7.Set>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> editSet(_i7.Set? workoutSet) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#editSet,
|
||||||
|
[workoutSet],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<List<_i7.Set>> reorderSets(
|
||||||
|
List<_i7.Set>? sets,
|
||||||
|
int? startIndex,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#reorderSets,
|
||||||
|
[
|
||||||
|
sets,
|
||||||
|
startIndex,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<List<_i7.Set>>.value(<_i7.Set>[]),
|
||||||
|
) as _i12.Future<List<_i7.Set>>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> fetchComputedSettings(_i7.Set? workoutSet) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchComputedSettings,
|
||||||
|
[workoutSet],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<String> fetchSmartText(
|
||||||
|
_i7.Set? workoutSet,
|
||||||
|
_i14.Translation? exercise,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchSmartText,
|
||||||
|
[
|
||||||
|
workoutSet,
|
||||||
|
exercise,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<String>.value(''),
|
||||||
|
) as _i12.Future<String>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> deleteSet(_i7.Set? workoutSet) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#deleteSet,
|
||||||
|
[workoutSet],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
_i12.Future<_i8.Setting> addSetting(_i8.Setting? workoutSetting) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addSetting,
|
||||||
|
[workoutSetting],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<_i8.Setting>.value(_FakeSetting_6(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#addSetting,
|
||||||
|
[workoutSetting],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i12.Future<_i8.Setting>);
|
||||||
|
@override
|
||||||
|
_i12.Future<dynamic> fetchSessionData() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchSessionData,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<dynamic>.value(),
|
||||||
|
) as _i12.Future<dynamic>);
|
||||||
|
@override
|
||||||
|
_i12.Future<_i9.WorkoutSession> addSession(_i9.WorkoutSession? session) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addSession,
|
||||||
|
[session],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<_i9.WorkoutSession>.value(_FakeWorkoutSession_7(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#addSession,
|
||||||
|
[session],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i12.Future<_i9.WorkoutSession>);
|
||||||
|
@override
|
||||||
|
_i12.Future<_i10.Log> addLog(_i10.Log? log) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addLog,
|
||||||
|
[log],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<_i10.Log>.value(_FakeLog_8(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#addLog,
|
||||||
|
[log],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i12.Future<_i10.Log>);
|
||||||
|
@override
|
||||||
|
_i12.Future<void> deleteLog(_i10.Log? log) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#deleteLog,
|
||||||
|
[log],
|
||||||
|
),
|
||||||
|
returnValue: _i12.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i12.Future<void>.value(),
|
||||||
|
) as _i12.Future<void>);
|
||||||
|
@override
|
||||||
|
void addListener(_i15.VoidCallback? listener) => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addListener,
|
||||||
|
[listener],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void removeListener(_i15.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,
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -19,19 +19,25 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:mockito/annotations.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:wger/providers/base_provider.dart';
|
||||||
|
import 'package:wger/providers/exercises.dart';
|
||||||
import 'package:wger/providers/workout_plans.dart';
|
import 'package:wger/providers/workout_plans.dart';
|
||||||
import 'package:wger/screens/workout_plan_screen.dart';
|
import 'package:wger/screens/workout_plan_screen.dart';
|
||||||
|
|
||||||
import '../../test_data/workouts.dart';
|
import '../../test_data/workouts.dart';
|
||||||
import '../utils.dart';
|
import 'workout_plan_screen_test.mocks.dart';
|
||||||
|
|
||||||
|
@GenerateMocks([WgerBaseProvider])
|
||||||
void main() {
|
void main() {
|
||||||
|
final mockBaseProvider = MockWgerBaseProvider();
|
||||||
|
final exercisesProvider = ExercisesProvider(mockBaseProvider);
|
||||||
Widget createHomeScreen({locale = 'en'}) {
|
Widget createHomeScreen({locale = 'en'}) {
|
||||||
final key = GlobalKey<NavigatorState>();
|
final key = GlobalKey<NavigatorState>();
|
||||||
|
|
||||||
return ChangeNotifierProvider<WorkoutPlansProvider>(
|
return ChangeNotifierProvider<WorkoutPlansProvider>(
|
||||||
create: (context) => WorkoutPlansProvider(mockBaseProvider, testExercisesProvider, []),
|
create: (context) => WorkoutPlansProvider(mockBaseProvider, exercisesProvider, []),
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
locale: Locale(locale),
|
locale: Locale(locale),
|
||||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||||
|
|||||||
213
test/workout/workout_plan_screen_test.mocks.dart
Normal file
213
test/workout/workout_plan_screen_test.mocks.dart
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
// Mocks generated by Mockito 5.3.2 from annotations
|
||||||
|
// in wger/test/workout/workout_plan_screen_test.dart.
|
||||||
|
// Do not manually edit this file.
|
||||||
|
|
||||||
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
|
import 'dart:async' as _i5;
|
||||||
|
|
||||||
|
import 'package:http/http.dart' as _i3;
|
||||||
|
import 'package:mockito/mockito.dart' as _i1;
|
||||||
|
import 'package:wger/providers/auth.dart' as _i2;
|
||||||
|
import 'package:wger/providers/base_provider.dart' as _i4;
|
||||||
|
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: avoid_redundant_argument_values
|
||||||
|
// ignore_for_file: avoid_setters_without_getters
|
||||||
|
// ignore_for_file: comment_references
|
||||||
|
// ignore_for_file: implementation_imports
|
||||||
|
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
||||||
|
// ignore_for_file: prefer_const_constructors
|
||||||
|
// ignore_for_file: unnecessary_parenthesis
|
||||||
|
// 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,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 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
|
||||||
|
set auth(_i2.AuthProvider? _auth) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#auth,
|
||||||
|
_auth,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
_i3.Client get client => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#client),
|
||||||
|
returnValue: _FakeClient_1(
|
||||||
|
this,
|
||||||
|
Invocation.getter(#client),
|
||||||
|
),
|
||||||
|
) as _i3.Client);
|
||||||
|
@override
|
||||||
|
set client(_i3.Client? _client) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#client,
|
||||||
|
_client,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
Map<String, String> getDefaultHeaders({dynamic 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
|
||||||
|
_i5.Future<Map<String, dynamic>> fetch(Uri? uri) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetch,
|
||||||
|
[uri],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||||
|
) as _i5.Future<Map<String, dynamic>>);
|
||||||
|
@override
|
||||||
|
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#fetchPaginated,
|
||||||
|
[uri],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<List<dynamic>>.value(<dynamic>[]),
|
||||||
|
) as _i5.Future<List<dynamic>>);
|
||||||
|
@override
|
||||||
|
_i5.Future<Map<String, dynamic>> post(
|
||||||
|
Map<String, dynamic>? data,
|
||||||
|
Uri? uri,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#post,
|
||||||
|
[
|
||||||
|
data,
|
||||||
|
uri,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||||
|
) as _i5.Future<Map<String, dynamic>>);
|
||||||
|
@override
|
||||||
|
_i5.Future<Map<String, dynamic>> patch(
|
||||||
|
Map<String, dynamic>? data,
|
||||||
|
Uri? uri,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#patch,
|
||||||
|
[
|
||||||
|
data,
|
||||||
|
uri,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||||
|
) as _i5.Future<Map<String, dynamic>>);
|
||||||
|
@override
|
||||||
|
_i5.Future<_i3.Response> deleteRequest(
|
||||||
|
String? url,
|
||||||
|
int? id,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#deleteRequest,
|
||||||
|
[
|
||||||
|
url,
|
||||||
|
id,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#deleteRequest,
|
||||||
|
[
|
||||||
|
url,
|
||||||
|
id,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
) as _i5.Future<_i3.Response>);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user