From 376ad83000bc7e2feedef81aa7cade712637a43e Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 1 Sep 2021 18:07:59 +0200 Subject: [PATCH] Add first version of tests for measurement screens --- test/base_provider_test.mocks.dart | 73 ++-- test/gallery_screen_test.mocks.dart | 149 +++---- .../measurement_categories_screen_test.dart | 65 +++ ...surement_categories_screen_test.mocks.dart | 118 ++++++ .../measurement_entries_screen_test.dart | 97 +++++ .../measurement_provider_test.mocks.dart | 2 +- test/nutritional_plan_form_test.mocks.dart | 233 ++++++----- test/workout_form_test.mocks.dart | 377 ++++++++++-------- test/workout_set_form_test.mocks.dart | 160 ++++---- 9 files changed, 827 insertions(+), 447 deletions(-) create mode 100644 test/measurements/measurement_categories_screen_test.dart create mode 100644 test/measurements/measurement_categories_screen_test.mocks.dart create mode 100644 test/measurements/measurement_entries_screen_test.dart diff --git a/test/base_provider_test.mocks.dart b/test/base_provider_test.mocks.dart index c35df7e2..34fef390 100644 --- a/test/base_provider_test.mocks.dart +++ b/test/base_provider_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.0.10 from annotations +// Mocks generated by Mockito 5.0.15 from annotations // in wger/test/base_provider_test.dart. // Do not manually edit this file. @@ -13,14 +13,17 @@ import 'package:http/src/streamed_response.dart' as _i3; import 'package:mockito/mockito.dart' as _i1; // 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 -class _FakeResponse extends _i1.Fake implements _i2.Response {} +class _FakeResponse_0 extends _i1.Fake implements _i2.Response {} -class _FakeStreamedResponse extends _i1.Fake implements _i3.StreamedResponse {} +class _FakeStreamedResponse_1 extends _i1.Fake implements _i3.StreamedResponse { +} /// A class which mocks [Client]. /// @@ -33,49 +36,73 @@ class MockClient extends _i1.Mock implements _i4.Client { @override _i5.Future<_i2.Response> head(Uri? url, {Map? headers}) => (super.noSuchMethod(Invocation.method(#head, [url], {#headers: headers}), - returnValue: Future<_i2.Response>.value(_FakeResponse())) as _i5.Future<_i2.Response>); + returnValue: Future<_i2.Response>.value(_FakeResponse_0())) + as _i5.Future<_i2.Response>); @override _i5.Future<_i2.Response> get(Uri? url, {Map? headers}) => (super.noSuchMethod(Invocation.method(#get, [url], {#headers: headers}), - returnValue: Future<_i2.Response>.value(_FakeResponse())) as _i5.Future<_i2.Response>); + returnValue: Future<_i2.Response>.value(_FakeResponse_0())) + as _i5.Future<_i2.Response>); @override _i5.Future<_i2.Response> post(Uri? url, - {Map? headers, Object? body, _i6.Encoding? encoding}) => + {Map? headers, + Object? body, + _i6.Encoding? encoding}) => (super.noSuchMethod( - Invocation.method(#post, [url], {#headers: headers, #body: body, #encoding: encoding}), - returnValue: Future<_i2.Response>.value(_FakeResponse())) as _i5.Future<_i2.Response>); + Invocation.method(#post, [url], + {#headers: headers, #body: body, #encoding: encoding}), + returnValue: Future<_i2.Response>.value(_FakeResponse_0())) + as _i5.Future<_i2.Response>); @override _i5.Future<_i2.Response> put(Uri? url, - {Map? headers, Object? body, _i6.Encoding? encoding}) => + {Map? headers, + Object? body, + _i6.Encoding? encoding}) => (super.noSuchMethod( - Invocation.method(#put, [url], {#headers: headers, #body: body, #encoding: encoding}), - returnValue: Future<_i2.Response>.value(_FakeResponse())) as _i5.Future<_i2.Response>); + Invocation.method(#put, [url], + {#headers: headers, #body: body, #encoding: encoding}), + returnValue: Future<_i2.Response>.value(_FakeResponse_0())) + as _i5.Future<_i2.Response>); @override _i5.Future<_i2.Response> patch(Uri? url, - {Map? headers, Object? body, _i6.Encoding? encoding}) => + {Map? headers, + Object? body, + _i6.Encoding? encoding}) => (super.noSuchMethod( - Invocation.method(#patch, [url], {#headers: headers, #body: body, #encoding: encoding}), - returnValue: Future<_i2.Response>.value(_FakeResponse())) as _i5.Future<_i2.Response>); + Invocation.method(#patch, [url], + {#headers: headers, #body: body, #encoding: encoding}), + returnValue: Future<_i2.Response>.value(_FakeResponse_0())) + as _i5.Future<_i2.Response>); @override _i5.Future<_i2.Response> delete(Uri? url, - {Map? headers, Object? body, _i6.Encoding? encoding}) => + {Map? headers, + Object? body, + _i6.Encoding? encoding}) => (super.noSuchMethod( - Invocation.method(#delete, [url], {#headers: headers, #body: body, #encoding: encoding}), - returnValue: Future<_i2.Response>.value(_FakeResponse())) as _i5.Future<_i2.Response>); + Invocation.method(#delete, [url], + {#headers: headers, #body: body, #encoding: encoding}), + returnValue: Future<_i2.Response>.value(_FakeResponse_0())) + as _i5.Future<_i2.Response>); @override _i5.Future read(Uri? url, {Map? headers}) => (super.noSuchMethod(Invocation.method(#read, [url], {#headers: headers}), returnValue: Future.value('')) as _i5.Future); @override - _i5.Future<_i7.Uint8List> readBytes(Uri? url, {Map? headers}) => - (super.noSuchMethod(Invocation.method(#readBytes, [url], {#headers: headers}), - returnValue: Future<_i7.Uint8List>.value(_i7.Uint8List(0))) as _i5.Future<_i7.Uint8List>); + _i5.Future<_i7.Uint8List> readBytes(Uri? url, + {Map? headers}) => + (super.noSuchMethod( + Invocation.method(#readBytes, [url], {#headers: headers}), + returnValue: Future<_i7.Uint8List>.value(_i7.Uint8List(0))) + as _i5.Future<_i7.Uint8List>); @override _i5.Future<_i3.StreamedResponse> send(_i8.BaseRequest? request) => (super.noSuchMethod(Invocation.method(#send, [request]), - returnValue: Future<_i3.StreamedResponse>.value(_FakeStreamedResponse())) + returnValue: + Future<_i3.StreamedResponse>.value(_FakeStreamedResponse_1())) as _i5.Future<_i3.StreamedResponse>); @override - void close() => - super.noSuchMethod(Invocation.method(#close, []), returnValueForMissingStub: null); + void close() => super.noSuchMethod(Invocation.method(#close, []), + returnValueForMissingStub: null); + @override + String toString() => super.toString(); } diff --git a/test/gallery_screen_test.mocks.dart b/test/gallery_screen_test.mocks.dart index af3bbb40..71fe46ee 100644 --- a/test/gallery_screen_test.mocks.dart +++ b/test/gallery_screen_test.mocks.dart @@ -1,122 +1,131 @@ -// Mocks generated by Mockito 5.0.10 from annotations +// Mocks generated by Mockito 5.0.15 from annotations // in wger/test/gallery_screen_test.dart. // Do not manually edit this file. -import 'dart:async' as _i7; -import 'dart:ui' as _i9; +import 'dart:async' as _i6; +import 'dart:ui' as _i8; -import 'package:http/src/client.dart' as _i3; -import 'package:http/src/response.dart' as _i4; -import 'package:image_picker_platform_interface/src/types/picked_file/io.dart' as _i8; +import 'package:http/http.dart' as _i3; +import 'package:image_picker/image_picker.dart' as _i7; import 'package:mockito/mockito.dart' as _i1; -import 'package:wger/models/gallery/image.dart' as _i6; +import 'package:wger/models/gallery/image.dart' as _i5; import 'package:wger/providers/auth.dart' as _i2; -import 'package:wger/providers/gallery.dart' as _i5; +import 'package:wger/providers/gallery.dart' as _i4; // 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 -class _FakeAuthProvider extends _i1.Fake implements _i2.AuthProvider {} +class _FakeAuthProvider_0 extends _i1.Fake implements _i2.AuthProvider {} -class _FakeClient extends _i1.Fake implements _i3.Client {} +class _FakeClient_1 extends _i1.Fake implements _i3.Client {} -class _FakeUri extends _i1.Fake implements Uri { - @override - String toString() => super.toString(); -} +class _FakeUri_2 extends _i1.Fake implements Uri {} -class _FakeResponse extends _i1.Fake implements _i4.Response {} +class _FakeResponse_3 extends _i1.Fake implements _i3.Response {} /// A class which mocks [GalleryProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockGalleryProvider extends _i1.Mock implements _i5.GalleryProvider { +class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { MockGalleryProvider() { _i1.throwOnMissingStub(this); } @override - List<_i6.Image> get images => - (super.noSuchMethod(Invocation.getter(#images), returnValue: <_i6.Image>[]) - as List<_i6.Image>); + List<_i5.Image> get images => (super.noSuchMethod(Invocation.getter(#images), + returnValue: <_i5.Image>[]) as List<_i5.Image>); @override - set images(List<_i6.Image>? _images) => - super.noSuchMethod(Invocation.setter(#images, _images), returnValueForMissingStub: null); + set images(List<_i5.Image>? _images) => + super.noSuchMethod(Invocation.setter(#images, _images), + returnValueForMissingStub: null); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); - @override - _i2.AuthProvider get auth => - (super.noSuchMethod(Invocation.getter(#auth), returnValue: _FakeAuthProvider()) - as _i2.AuthProvider); + _i2.AuthProvider get auth => (super.noSuchMethod(Invocation.getter(#auth), + returnValue: _FakeAuthProvider_0()) as _i2.AuthProvider); @override set auth(_i2.AuthProvider? _auth) => - super.noSuchMethod(Invocation.setter(#auth, _auth), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#auth, _auth), + returnValueForMissingStub: null); @override - _i3.Client get client => - (super.noSuchMethod(Invocation.getter(#client), returnValue: _FakeClient()) as _i3.Client); + _i3.Client get client => (super.noSuchMethod(Invocation.getter(#client), + returnValue: _FakeClient_1()) as _i3.Client); @override set client(_i3.Client? _client) => - super.noSuchMethod(Invocation.setter(#client, _client), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#client, _client), + returnValueForMissingStub: null); @override - _i7.Future fetchAndSetGallery() => + bool get hasListeners => + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); + @override + _i6.Future fetchAndSetGallery() => (super.noSuchMethod(Invocation.method(#fetchAndSetGallery, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i7.Future); + returnValueForMissingStub: Future.value()) as _i6.Future); @override - _i7.Future addImage(_i6.Image? image, _i8.PickedFile? imageFile) => + _i6.Future addImage(_i5.Image? image, _i7.PickedFile? imageFile) => (super.noSuchMethod(Invocation.method(#addImage, [image, imageFile]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i7.Future); + returnValueForMissingStub: Future.value()) as _i6.Future); @override - _i7.Future editImage(_i6.Image? image, _i8.PickedFile? imageFile) => + _i6.Future editImage(_i5.Image? image, _i7.PickedFile? imageFile) => (super.noSuchMethod(Invocation.method(#editImage, [image, imageFile]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i7.Future); + returnValueForMissingStub: Future.value()) as _i6.Future); @override - _i7.Future deleteImage(_i6.Image? image) => + _i6.Future deleteImage(_i5.Image? image) => (super.noSuchMethod(Invocation.method(#deleteImage, [image]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i7.Future); + returnValueForMissingStub: Future.value()) as _i6.Future); @override - void addListener(_i9.VoidCallback? listener) => super - .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); + Uri makeUrl(String? path, + {int? id, String? objectMethod, Map? query}) => + (super.noSuchMethod( + Invocation.method(#makeUrl, [path], + {#id: id, #objectMethod: objectMethod, #query: query}), + returnValue: _FakeUri_2()) as Uri); @override - void removeListener(_i9.VoidCallback? listener) => + _i6.Future> fetch(Uri? uri) => (super.noSuchMethod( + Invocation.method(#fetch, [uri]), + returnValue: Future>.value({})) + as _i6.Future>); + @override + _i6.Future> post(Map? data, Uri? uri) => + (super.noSuchMethod(Invocation.method(#post, [data, uri]), + returnValue: + Future>.value({})) + as _i6.Future>); + @override + _i6.Future> patch( + Map? data, Uri? uri) => + (super.noSuchMethod(Invocation.method(#patch, [data, uri]), + returnValue: + Future>.value({})) + as _i6.Future>); + @override + _i6.Future<_i3.Response> deleteRequest(String? url, int? id) => + (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), + returnValue: Future<_i3.Response>.value(_FakeResponse_3())) + as _i6.Future<_i3.Response>); + @override + String toString() => super.toString(); + @override + void addListener(_i8.VoidCallback? listener) => + super.noSuchMethod(Invocation.method(#addListener, [listener]), + returnValueForMissingStub: null); + @override + void removeListener(_i8.VoidCallback? listener) => super.noSuchMethod(Invocation.method(#removeListener, [listener]), returnValueForMissingStub: null); @override - void dispose() => - super.noSuchMethod(Invocation.method(#dispose, []), returnValueForMissingStub: null); + void dispose() => super.noSuchMethod(Invocation.method(#dispose, []), + returnValueForMissingStub: null); @override void notifyListeners() => - super.noSuchMethod(Invocation.method(#notifyListeners, []), returnValueForMissingStub: null); - @override - Uri makeUrl(String? path, {int? id, String? objectMethod, Map? query}) => - (super.noSuchMethod( - Invocation.method( - #makeUrl, [path], {#id: id, #objectMethod: objectMethod, #query: query}), - returnValue: _FakeUri()) as Uri); - @override - _i7.Future> fetch(Uri? uri) => - (super.noSuchMethod(Invocation.method(#fetch, [uri]), - returnValue: Future>.value({})) - as _i7.Future>); - @override - _i7.Future> post(Map? data, Uri? uri) => - (super.noSuchMethod(Invocation.method(#post, [data, uri]), - returnValue: Future>.value({})) - as _i7.Future>); - @override - _i7.Future> patch(Map? data, Uri? uri) => - (super.noSuchMethod(Invocation.method(#patch, [data, uri]), - returnValue: Future>.value({})) - as _i7.Future>); - @override - _i7.Future<_i4.Response> deleteRequest(String? url, int? id) => - (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), - returnValue: Future<_i4.Response>.value(_FakeResponse())) as _i7.Future<_i4.Response>); + super.noSuchMethod(Invocation.method(#notifyListeners, []), + returnValueForMissingStub: null); } diff --git a/test/measurements/measurement_categories_screen_test.dart b/test/measurements/measurement_categories_screen_test.dart new file mode 100644 index 00000000..d4209db4 --- /dev/null +++ b/test/measurements/measurement_categories_screen_test.dart @@ -0,0 +1,65 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wger Workout Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; +import 'package:provider/provider.dart'; +import 'package:wger/models/measurements/measurement_category.dart'; +import 'package:wger/providers/measurement.dart'; +import 'package:wger/screens/measurement_categories_screen.dart'; + +import 'measurement_categories_screen_test.mocks.dart'; + +@GenerateMocks([MeasurementProvider]) +void main() { + late MeasurementProvider mockMeasurementProvider; + + setUp(() { + mockMeasurementProvider = MockMeasurementProvider(); + when(mockMeasurementProvider.categories).thenReturn([ + MeasurementCategory(id: 1, name: 'body fat', unit: '%'), + MeasurementCategory(id: 2, name: 'biceps', unit: 'cm'), + ]); + }); + + Widget createHomeScreen({locale = 'en'}) { + return ChangeNotifierProvider( + create: (context) => mockMeasurementProvider, + child: MaterialApp( + locale: Locale(locale), + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + home: MeasurementCategoriesScreen(), + ), + ); + } + + testWidgets('Test the widgets on the measurement category screen', (WidgetTester tester) async { + await tester.pumpWidget(createHomeScreen()); + + expect(find.text('Measurement categories'), findsOneWidget); + expect(find.text('body fat'), findsOneWidget); + expect(find.text('%'), findsOneWidget); + + expect(find.text('biceps'), findsOneWidget); + expect(find.text('cm'), findsOneWidget); + }); +} diff --git a/test/measurements/measurement_categories_screen_test.mocks.dart b/test/measurements/measurement_categories_screen_test.mocks.dart new file mode 100644 index 00000000..3fb35a55 --- /dev/null +++ b/test/measurements/measurement_categories_screen_test.mocks.dart @@ -0,0 +1,118 @@ +// Mocks generated by Mockito 5.0.15 from annotations +// in wger/test/measurements/measurement_categories_screen_test.dart. +// Do not manually edit this file. + +import 'dart:async' as _i5; +import 'dart:ui' as _i7; + +import 'package:mockito/mockito.dart' as _i1; +import 'package:wger/models/measurements/measurement_category.dart' as _i3; +import 'package:wger/models/measurements/measurement_entry.dart' as _i6; +import 'package:wger/providers/base_provider.dart' as _i2; +import 'package:wger/providers/measurement.dart' as _i4; + +// 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 + +class _FakeWgerBaseProvider_0 extends _i1.Fake implements _i2.WgerBaseProvider { +} + +class _FakeMeasurementCategory_1 extends _i1.Fake + implements _i3.MeasurementCategory {} + +/// A class which mocks [MeasurementProvider]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockMeasurementProvider extends _i1.Mock + implements _i4.MeasurementProvider { + MockMeasurementProvider() { + _i1.throwOnMissingStub(this); + } + + @override + _i2.WgerBaseProvider get baseProvider => + (super.noSuchMethod(Invocation.getter(#baseProvider), + returnValue: _FakeWgerBaseProvider_0()) as _i2.WgerBaseProvider); + @override + List<_i3.MeasurementCategory> get categories => + (super.noSuchMethod(Invocation.getter(#categories), + returnValue: <_i3.MeasurementCategory>[]) + as List<_i3.MeasurementCategory>); + @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.MeasurementCategory findCategoryById(int? id) => (super.noSuchMethod( + Invocation.method(#findCategoryById, [id]), + returnValue: _FakeMeasurementCategory_1()) as _i3.MeasurementCategory); + @override + _i5.Future fetchAndSetCategories() => + (super.noSuchMethod(Invocation.method(#fetchAndSetCategories, []), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i5.Future); + @override + _i5.Future fetchAndSetCategoryEntries(int? id) => + (super.noSuchMethod(Invocation.method(#fetchAndSetCategoryEntries, [id]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i5.Future); + @override + _i5.Future addCategory(_i3.MeasurementCategory? category) => + (super.noSuchMethod(Invocation.method(#addCategory, [category]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i5.Future); + @override + _i5.Future deleteCategory(int? id) => + (super.noSuchMethod(Invocation.method(#deleteCategory, [id]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i5.Future); + @override + _i5.Future editCategory(int? id, String? newName, String? newUnit) => + (super.noSuchMethod( + Invocation.method(#editCategory, [id, newName, newUnit]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i5.Future); + @override + _i5.Future addEntry(_i6.MeasurementEntry? entry) => + (super.noSuchMethod(Invocation.method(#addEntry, [entry]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i5.Future); + @override + _i5.Future deleteEntry(int? id, int? categoryId) => + (super.noSuchMethod(Invocation.method(#deleteEntry, [id, categoryId]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i5.Future); + @override + _i5.Future editEntry(int? id, int? categoryId, num? newValue, + String? newNotes, DateTime? newDate) => + (super.noSuchMethod( + Invocation.method( + #editEntry, [id, categoryId, newValue, newNotes, newDate]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i5.Future); + @override + String toString() => super.toString(); + @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); +} diff --git a/test/measurements/measurement_entries_screen_test.dart b/test/measurements/measurement_entries_screen_test.dart new file mode 100644 index 00000000..b552e5ba --- /dev/null +++ b/test/measurements/measurement_entries_screen_test.dart @@ -0,0 +1,97 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wger Workout Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:provider/provider.dart'; +import 'package:wger/models/measurements/measurement_category.dart'; +import 'package:wger/models/measurements/measurement_entry.dart'; +import 'package:wger/providers/measurement.dart'; +import 'package:wger/screens/measurement_entries_screen.dart'; + +import 'measurement_categories_screen_test.mocks.dart'; + +void main() { + late MockMeasurementProvider mockMeasurementProvider; + + setUp(() { + mockMeasurementProvider = MockMeasurementProvider(); + when(mockMeasurementProvider.findCategoryById(any)).thenReturn( + MeasurementCategory(id: 1, name: 'body fat', unit: '%', entries: [ + MeasurementEntry(id: 1, category: 1, date: DateTime(2021, 8, 1), value: 10.2, notes: ''), + MeasurementEntry(id: 1, category: 1, date: DateTime(2021, 8, 10), value: 18.1, notes: 'a'), + ]), + ); + }); + + Widget createHomeScreen({locale = 'en'}) { + final key = GlobalKey(); + + return ChangeNotifierProvider( + create: (context) => mockMeasurementProvider, + child: MaterialApp( + locale: Locale(locale), + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + navigatorKey: key, + home: TextButton( + onPressed: () => key.currentState!.push( + MaterialPageRoute( + settings: RouteSettings(arguments: 1), + builder: (_) => MeasurementEntriesScreen(), + ), + ), + child: Container(), + ), + ), + ); + } + + testWidgets('Test the widgets on the measurement entries screen', (WidgetTester tester) async { + await tester.pumpWidget(createHomeScreen()); + await tester.tap(find.byType(TextButton)); + await tester.pumpAndSettle(); + + // Nav bar + expect(find.text('body fat'), findsOneWidget); + + // Entries + expect(find.text('10.2 %'), findsOneWidget); + expect(find.text('18.1 %'), findsOneWidget); + }); + + testWidgets('Tests the localization of dates - EN', (WidgetTester tester) async { + await tester.pumpWidget(createHomeScreen()); + await tester.tap(find.byType(TextButton)); + await tester.pumpAndSettle(); + + expect(find.text('8/1/2021'), findsOneWidget); + expect(find.text('8/10/2021'), findsOneWidget); + }); + + testWidgets('Tests the localization of dates - DE', (WidgetTester tester) async { + await tester.pumpWidget(createHomeScreen(locale: 'de')); + await tester.tap(find.byType(TextButton)); + await tester.pumpAndSettle(); + + expect(find.text('1.8.2021'), findsOneWidget); + expect(find.text('10.8.2021'), findsOneWidget); + }); +} diff --git a/test/measurements/measurement_provider_test.mocks.dart b/test/measurements/measurement_provider_test.mocks.dart index 61b3ef05..279715bb 100644 --- a/test/measurements/measurement_provider_test.mocks.dart +++ b/test/measurements/measurement_provider_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.0.14 from annotations +// Mocks generated by Mockito 5.0.15 from annotations // in wger/test/measurements/measurement_provider_test.dart. // Do not manually edit this file. diff --git a/test/nutritional_plan_form_test.mocks.dart b/test/nutritional_plan_form_test.mocks.dart index c4229de8..7558ddf1 100644 --- a/test/nutritional_plan_form_test.mocks.dart +++ b/test/nutritional_plan_form_test.mocks.dart @@ -1,195 +1,222 @@ -// Mocks generated by Mockito 5.0.10 from annotations +// Mocks generated by Mockito 5.0.15 from annotations // in wger/test/nutritional_plan_form_test.dart. // Do not manually edit this file. -import 'dart:async' as _i10; -import 'dart:ui' as _i11; +import 'dart:async' as _i9; +import 'dart:ui' as _i10; -import 'package:http/src/client.dart' as _i3; -import 'package:http/src/response.dart' as _i8; +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 _i9; +import 'package:wger/providers/nutrition.dart' as _i8; // 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 -class _FakeAuthProvider extends _i1.Fake implements _i2.AuthProvider {} +class _FakeAuthProvider_0 extends _i1.Fake implements _i2.AuthProvider {} -class _FakeClient extends _i1.Fake implements _i3.Client {} +class _FakeClient_1 extends _i1.Fake implements _i3.Client {} -class _FakeNutritionalPlan extends _i1.Fake implements _i4.NutritionalPlan {} +class _FakeNutritionalPlan_2 extends _i1.Fake implements _i4.NutritionalPlan {} -class _FakeMeal extends _i1.Fake implements _i5.Meal {} +class _FakeMeal_3 extends _i1.Fake implements _i5.Meal {} -class _FakeMealItem extends _i1.Fake implements _i6.MealItem {} +class _FakeMealItem_4 extends _i1.Fake implements _i6.MealItem {} -class _FakeIngredient extends _i1.Fake implements _i7.Ingredient {} +class _FakeIngredient_5 extends _i1.Fake implements _i7.Ingredient {} -class _FakeUri extends _i1.Fake implements Uri { - @override - String toString() => super.toString(); -} +class _FakeUri_6 extends _i1.Fake implements Uri {} -class _FakeResponse extends _i1.Fake implements _i8.Response {} +class _FakeResponse_7 extends _i1.Fake implements _i3.Response {} /// A class which mocks [NutritionPlansProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockNutritionPlansProvider extends _i1.Mock implements _i9.NutritionPlansProvider { +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>); + (super.noSuchMethod(Invocation.getter(#items), + returnValue: <_i4.NutritionalPlan>[]) as List<_i4.NutritionalPlan>); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); - @override - _i2.AuthProvider get auth => - (super.noSuchMethod(Invocation.getter(#auth), returnValue: _FakeAuthProvider()) - as _i2.AuthProvider); + _i2.AuthProvider get auth => (super.noSuchMethod(Invocation.getter(#auth), + returnValue: _FakeAuthProvider_0()) as _i2.AuthProvider); @override set auth(_i2.AuthProvider? _auth) => - super.noSuchMethod(Invocation.setter(#auth, _auth), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#auth, _auth), + returnValueForMissingStub: null); @override - _i3.Client get client => - (super.noSuchMethod(Invocation.getter(#client), returnValue: _FakeClient()) as _i3.Client); + _i3.Client get client => (super.noSuchMethod(Invocation.getter(#client), + returnValue: _FakeClient_1()) as _i3.Client); @override set client(_i3.Client? _client) => - super.noSuchMethod(Invocation.setter(#client, _client), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#client, _client), + returnValueForMissingStub: null); + @override + bool get hasListeners => + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override _i4.NutritionalPlan findById(int? id) => - (super.noSuchMethod(Invocation.method(#findById, [id]), returnValue: _FakeNutritionalPlan()) - as _i4.NutritionalPlan); + (super.noSuchMethod(Invocation.method(#findById, [id]), + returnValue: _FakeNutritionalPlan_2()) as _i4.NutritionalPlan); @override _i5.Meal? findMealById(int? id) => (super.noSuchMethod(Invocation.method(#findMealById, [id])) as _i5.Meal?); @override - _i10.Future fetchAndSetAllPlansSparse() => + _i9.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod(Invocation.method(#fetchAndSetAllPlansSparse, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i10.Future); + returnValueForMissingStub: Future.value()) as _i9.Future); @override - _i10.Future fetchAndSetAllPlansFull() => + _i9.Future fetchAndSetAllPlansFull() => (super.noSuchMethod(Invocation.method(#fetchAndSetAllPlansFull, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i10.Future); + returnValueForMissingStub: Future.value()) as _i9.Future); @override - _i10.Future<_i4.NutritionalPlan> fetchAndSetPlanSparse(int? planId) => + _i9.Future<_i4.NutritionalPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod(Invocation.method(#fetchAndSetPlanSparse, [planId]), - returnValue: Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan())) - as _i10.Future<_i4.NutritionalPlan>); + returnValue: + Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2())) + as _i9.Future<_i4.NutritionalPlan>); @override - _i10.Future<_i4.NutritionalPlan> fetchAndSetPlanFull(int? planId) => + _i9.Future<_i4.NutritionalPlan> fetchAndSetPlanFull(int? planId) => (super.noSuchMethod(Invocation.method(#fetchAndSetPlanFull, [planId]), - returnValue: Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan())) - as _i10.Future<_i4.NutritionalPlan>); + returnValue: + Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2())) + as _i9.Future<_i4.NutritionalPlan>); @override - _i10.Future<_i4.NutritionalPlan> addPlan(_i4.NutritionalPlan? planData) => + _i9.Future<_i4.NutritionalPlan> addPlan(_i4.NutritionalPlan? planData) => (super.noSuchMethod(Invocation.method(#addPlan, [planData]), - returnValue: Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan())) - as _i10.Future<_i4.NutritionalPlan>); + returnValue: + Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2())) + as _i9.Future<_i4.NutritionalPlan>); @override - _i10.Future editPlan(_i4.NutritionalPlan? plan) => + _i9.Future editPlan(_i4.NutritionalPlan? plan) => (super.noSuchMethod(Invocation.method(#editPlan, [plan]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i10.Future); + returnValueForMissingStub: Future.value()) as _i9.Future); @override - _i10.Future deletePlan(int? id) => (super.noSuchMethod(Invocation.method(#deletePlan, [id]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i10.Future); + _i9.Future deletePlan(int? id) => + (super.noSuchMethod(Invocation.method(#deletePlan, [id]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i9.Future); @override - _i10.Future<_i5.Meal> addMeal(_i5.Meal? meal, int? planId) => + _i9.Future<_i5.Meal> addMeal(_i5.Meal? meal, int? planId) => (super.noSuchMethod(Invocation.method(#addMeal, [meal, planId]), - returnValue: Future<_i5.Meal>.value(_FakeMeal())) as _i10.Future<_i5.Meal>); + returnValue: Future<_i5.Meal>.value(_FakeMeal_3())) + as _i9.Future<_i5.Meal>); @override - _i10.Future<_i5.Meal> editMeal(_i5.Meal? meal) => + _i9.Future<_i5.Meal> editMeal(_i5.Meal? meal) => (super.noSuchMethod(Invocation.method(#editMeal, [meal]), - returnValue: Future<_i5.Meal>.value(_FakeMeal())) as _i10.Future<_i5.Meal>); + returnValue: Future<_i5.Meal>.value(_FakeMeal_3())) + as _i9.Future<_i5.Meal>); @override - _i10.Future deleteMeal(_i5.Meal? meal) => + _i9.Future deleteMeal(_i5.Meal? meal) => (super.noSuchMethod(Invocation.method(#deleteMeal, [meal]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i10.Future); + returnValueForMissingStub: Future.value()) as _i9.Future); @override - _i10.Future<_i6.MealItem> addMealItem(_i6.MealItem? mealItem, _i5.Meal? meal) => + _i9.Future<_i6.MealItem> addMealItem( + _i6.MealItem? mealItem, _i5.Meal? meal) => (super.noSuchMethod(Invocation.method(#addMealItem, [mealItem, meal]), - returnValue: Future<_i6.MealItem>.value(_FakeMealItem())) as _i10.Future<_i6.MealItem>); + returnValue: Future<_i6.MealItem>.value(_FakeMealItem_4())) + as _i9.Future<_i6.MealItem>); @override - _i10.Future deleteMealItem(_i6.MealItem? mealItem) => + _i9.Future deleteMealItem(_i6.MealItem? mealItem) => (super.noSuchMethod(Invocation.method(#deleteMealItem, [mealItem]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i10.Future); + returnValueForMissingStub: Future.value()) as _i9.Future); @override - _i10.Future<_i7.Ingredient> fetchIngredient(int? ingredientId) => (super.noSuchMethod( - Invocation.method(#fetchIngredient, [ingredientId]), - returnValue: Future<_i7.Ingredient>.value(_FakeIngredient())) as _i10.Future<_i7.Ingredient>); + _i9.Future<_i7.Ingredient> fetchIngredient(int? ingredientId) => + (super.noSuchMethod(Invocation.method(#fetchIngredient, [ingredientId]), + returnValue: Future<_i7.Ingredient>.value(_FakeIngredient_5())) + as _i9.Future<_i7.Ingredient>); @override - _i10.Future fetchIngredientsFromCache() => + _i9.Future fetchIngredientsFromCache() => (super.noSuchMethod(Invocation.method(#fetchIngredientsFromCache, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i10.Future); + returnValueForMissingStub: Future.value()) as _i9.Future); @override - _i10.Future> searchIngredient(String? name, [String? languageCode = r'en']) => - (super.noSuchMethod(Invocation.method(#searchIngredient, [name, languageCode]), - returnValue: Future>.value([])) as _i10.Future>); + _i9.Future> searchIngredient(String? name, + [String? languageCode = r'en']) => + (super.noSuchMethod( + Invocation.method(#searchIngredient, [name, languageCode]), + returnValue: Future>.value([])) + as _i9.Future>); @override - _i10.Future logMealToDiary(_i5.Meal? meal) => + _i9.Future logMealToDiary(_i5.Meal? meal) => (super.noSuchMethod(Invocation.method(#logMealToDiary, [meal]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i10.Future); + returnValueForMissingStub: Future.value()) as _i9.Future); @override - _i10.Future fetchAndSetLogs(_i4.NutritionalPlan? plan) => + _i9.Future deleteLog(int? logId, int? planId) => + (super.noSuchMethod(Invocation.method(#deleteLog, [logId, planId]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i9.Future); + @override + _i9.Future fetchAndSetLogs(_i4.NutritionalPlan? plan) => (super.noSuchMethod(Invocation.method(#fetchAndSetLogs, [plan]), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i10.Future); + returnValueForMissingStub: Future.value()) as _i9.Future); @override - void addListener(_i11.VoidCallback? listener) => super - .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); + Uri makeUrl(String? path, + {int? id, String? objectMethod, Map? query}) => + (super.noSuchMethod( + Invocation.method(#makeUrl, [path], + {#id: id, #objectMethod: objectMethod, #query: query}), + returnValue: _FakeUri_6()) as Uri); @override - void removeListener(_i11.VoidCallback? listener) => + _i9.Future> fetch(Uri? uri) => (super.noSuchMethod( + Invocation.method(#fetch, [uri]), + returnValue: Future>.value({})) + as _i9.Future>); + @override + _i9.Future> post(Map? data, Uri? uri) => + (super.noSuchMethod(Invocation.method(#post, [data, uri]), + returnValue: + Future>.value({})) + as _i9.Future>); + @override + _i9.Future> patch( + Map? data, Uri? uri) => + (super.noSuchMethod(Invocation.method(#patch, [data, uri]), + returnValue: + Future>.value({})) + as _i9.Future>); + @override + _i9.Future<_i3.Response> deleteRequest(String? url, int? id) => + (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), + returnValue: Future<_i3.Response>.value(_FakeResponse_7())) + as _i9.Future<_i3.Response>); + @override + String toString() => super.toString(); + @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); + void dispose() => super.noSuchMethod(Invocation.method(#dispose, []), + returnValueForMissingStub: null); @override void notifyListeners() => - super.noSuchMethod(Invocation.method(#notifyListeners, []), returnValueForMissingStub: null); - @override - Uri makeUrl(String? path, {int? id, String? objectMethod, Map? query}) => - (super.noSuchMethod( - Invocation.method( - #makeUrl, [path], {#id: id, #objectMethod: objectMethod, #query: query}), - returnValue: _FakeUri()) as Uri); - @override - _i10.Future> fetch(Uri? uri) => - (super.noSuchMethod(Invocation.method(#fetch, [uri]), - returnValue: Future>.value({})) - as _i10.Future>); - @override - _i10.Future> post(Map? data, Uri? uri) => - (super.noSuchMethod(Invocation.method(#post, [data, uri]), - returnValue: Future>.value({})) - as _i10.Future>); - @override - _i10.Future> patch(Map? data, Uri? uri) => - (super.noSuchMethod(Invocation.method(#patch, [data, uri]), - returnValue: Future>.value({})) - as _i10.Future>); - @override - _i10.Future<_i8.Response> deleteRequest(String? url, int? id) => - (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), - returnValue: Future<_i8.Response>.value(_FakeResponse())) as _i10.Future<_i8.Response>); + super.noSuchMethod(Invocation.method(#notifyListeners, []), + returnValueForMissingStub: null); } diff --git a/test/workout_form_test.mocks.dart b/test/workout_form_test.mocks.dart index ac60c982..12a1f750 100644 --- a/test/workout_form_test.mocks.dart +++ b/test/workout_form_test.mocks.dart @@ -1,14 +1,13 @@ -// Mocks generated by Mockito 5.0.10 from annotations +// Mocks generated by Mockito 5.0.15 from annotations // in wger/test/workout_form_test.dart. // Do not manually edit this file. -import 'dart:async' as _i14; -import 'dart:ui' as _i16; +import 'dart:async' as _i13; +import 'dart:ui' as _i15; -import 'package:http/src/client.dart' as _i5; -import 'package:http/src/response.dart' as _i12; +import 'package:http/http.dart' as _i5; import 'package:mockito/mockito.dart' as _i1; -import 'package:wger/models/exercises/exercise.dart' as _i15; +import 'package:wger/models/exercises/exercise.dart' as _i14; import 'package:wger/models/workouts/day.dart' as _i7; import 'package:wger/models/workouts/log.dart' as _i11; import 'package:wger/models/workouts/repetition_unit.dart' as _i3; @@ -18,250 +17,276 @@ import 'package:wger/models/workouts/setting.dart' as _i9; import 'package:wger/models/workouts/weight_unit.dart' as _i2; import 'package:wger/models/workouts/workout_plan.dart' as _i6; import 'package:wger/providers/auth.dart' as _i4; -import 'package:wger/providers/workout_plans.dart' as _i13; +import 'package:wger/providers/workout_plans.dart' as _i12; // 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 -class _FakeWeightUnit extends _i1.Fake implements _i2.WeightUnit {} +class _FakeWeightUnit_0 extends _i1.Fake implements _i2.WeightUnit {} -class _FakeRepetitionUnit extends _i1.Fake implements _i3.RepetitionUnit {} +class _FakeRepetitionUnit_1 extends _i1.Fake implements _i3.RepetitionUnit {} -class _FakeAuthProvider extends _i1.Fake implements _i4.AuthProvider {} +class _FakeAuthProvider_2 extends _i1.Fake implements _i4.AuthProvider {} -class _FakeClient extends _i1.Fake implements _i5.Client {} +class _FakeClient_3 extends _i1.Fake implements _i5.Client {} -class _FakeWorkoutPlan extends _i1.Fake implements _i6.WorkoutPlan {} +class _FakeWorkoutPlan_4 extends _i1.Fake implements _i6.WorkoutPlan {} -class _FakeDay extends _i1.Fake implements _i7.Day {} +class _FakeDay_5 extends _i1.Fake implements _i7.Day {} -class _FakeSet extends _i1.Fake implements _i8.Set {} +class _FakeSet_6 extends _i1.Fake implements _i8.Set {} -class _FakeSetting extends _i1.Fake implements _i9.Setting {} +class _FakeSetting_7 extends _i1.Fake implements _i9.Setting {} -class _FakeWorkoutSession extends _i1.Fake implements _i10.WorkoutSession {} +class _FakeWorkoutSession_8 extends _i1.Fake implements _i10.WorkoutSession {} -class _FakeLog extends _i1.Fake implements _i11.Log { - @override - String toString() => super.toString(); -} +class _FakeLog_9 extends _i1.Fake implements _i11.Log {} -class _FakeUri extends _i1.Fake implements Uri { - @override - String toString() => super.toString(); -} +class _FakeUri_10 extends _i1.Fake implements Uri {} -class _FakeResponse extends _i1.Fake implements _i12.Response {} +class _FakeResponse_11 extends _i1.Fake implements _i5.Response {} /// A class which mocks [WorkoutPlansProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockWorkoutPlansProvider extends _i1.Mock implements _i13.WorkoutPlansProvider { +class MockWorkoutPlansProvider extends _i1.Mock + implements _i12.WorkoutPlansProvider { MockWorkoutPlansProvider() { _i1.throwOnMissingStub(this); } @override List<_i6.WorkoutPlan> get items => - (super.noSuchMethod(Invocation.getter(#items), returnValue: <_i6.WorkoutPlan>[]) - as List<_i6.WorkoutPlan>); + (super.noSuchMethod(Invocation.getter(#items), + returnValue: <_i6.WorkoutPlan>[]) as List<_i6.WorkoutPlan>); @override List<_i2.WeightUnit> get weightUnits => - (super.noSuchMethod(Invocation.getter(#weightUnits), returnValue: <_i2.WeightUnit>[]) - as List<_i2.WeightUnit>); + (super.noSuchMethod(Invocation.getter(#weightUnits), + returnValue: <_i2.WeightUnit>[]) as List<_i2.WeightUnit>); @override _i2.WeightUnit get defaultWeightUnit => - (super.noSuchMethod(Invocation.getter(#defaultWeightUnit), returnValue: _FakeWeightUnit()) - as _i2.WeightUnit); + (super.noSuchMethod(Invocation.getter(#defaultWeightUnit), + returnValue: _FakeWeightUnit_0()) as _i2.WeightUnit); @override List<_i3.RepetitionUnit> get repetitionUnits => - (super.noSuchMethod(Invocation.getter(#repetitionUnits), returnValue: <_i3.RepetitionUnit>[]) - as List<_i3.RepetitionUnit>); + (super.noSuchMethod(Invocation.getter(#repetitionUnits), + returnValue: <_i3.RepetitionUnit>[]) as List<_i3.RepetitionUnit>); @override _i3.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod(Invocation.getter(#defaultRepetitionUnit), - returnValue: _FakeRepetitionUnit()) as _i3.RepetitionUnit); + returnValue: _FakeRepetitionUnit_1()) as _i3.RepetitionUnit); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); - @override - _i4.AuthProvider get auth => - (super.noSuchMethod(Invocation.getter(#auth), returnValue: _FakeAuthProvider()) - as _i4.AuthProvider); + _i4.AuthProvider get auth => (super.noSuchMethod(Invocation.getter(#auth), + returnValue: _FakeAuthProvider_2()) as _i4.AuthProvider); @override set auth(_i4.AuthProvider? _auth) => - super.noSuchMethod(Invocation.setter(#auth, _auth), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#auth, _auth), + returnValueForMissingStub: null); @override - _i5.Client get client => - (super.noSuchMethod(Invocation.getter(#client), returnValue: _FakeClient()) as _i5.Client); + _i5.Client get client => (super.noSuchMethod(Invocation.getter(#client), + returnValue: _FakeClient_3()) as _i5.Client); @override set client(_i5.Client? _client) => - super.noSuchMethod(Invocation.setter(#client, _client), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#client, _client), + returnValueForMissingStub: null); + @override + bool get hasListeners => + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override _i6.WorkoutPlan findById(int? id) => - (super.noSuchMethod(Invocation.method(#findById, [id]), returnValue: _FakeWorkoutPlan()) - as _i6.WorkoutPlan); + (super.noSuchMethod(Invocation.method(#findById, [id]), + returnValue: _FakeWorkoutPlan_4()) as _i6.WorkoutPlan); @override - int findIndexById(int? id) => - (super.noSuchMethod(Invocation.method(#findIndexById, [id]), returnValue: 0) as int); + 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); + super.noSuchMethod(Invocation.method(#setCurrentPlan, [id]), + returnValueForMissingStub: null); @override void resetCurrentPlan() => - super.noSuchMethod(Invocation.method(#resetCurrentPlan, []), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.method(#resetCurrentPlan, []), + returnValueForMissingStub: null); @override - _i14.Future fetchAndSetAllPlansFull() => - (super.noSuchMethod(Invocation.method(#fetchAndSetAllPlansFull, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i14.Future); - @override - _i14.Future fetchAndSetAllPlansSparse() => - (super.noSuchMethod(Invocation.method(#fetchAndSetAllPlansSparse, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i14.Future); - @override - _i14.Future<_i6.WorkoutPlan> fetchAndSetPlanSparse(int? planId) => - (super.noSuchMethod(Invocation.method(#fetchAndSetPlanSparse, [planId]), - returnValue: Future<_i6.WorkoutPlan>.value(_FakeWorkoutPlan())) - as _i14.Future<_i6.WorkoutPlan>); - @override - _i14.Future<_i6.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) => - (super.noSuchMethod(Invocation.method(#fetchAndSetWorkoutPlanFull, [workoutId]), - returnValue: Future<_i6.WorkoutPlan>.value(_FakeWorkoutPlan())) - as _i14.Future<_i6.WorkoutPlan>); - @override - _i14.Future<_i6.WorkoutPlan> addWorkout(_i6.WorkoutPlan? workout) => - (super.noSuchMethod(Invocation.method(#addWorkout, [workout]), - returnValue: Future<_i6.WorkoutPlan>.value(_FakeWorkoutPlan())) - as _i14.Future<_i6.WorkoutPlan>); - @override - _i14.Future editWorkout(_i6.WorkoutPlan? workout) => - (super.noSuchMethod(Invocation.method(#editWorkout, [workout]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i14.Future); - @override - _i14.Future deleteWorkout(int? id) => - (super.noSuchMethod(Invocation.method(#deleteWorkout, [id]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i14.Future); - @override - _i14.Future> fetchLogData( - _i6.WorkoutPlan? workout, _i15.Exercise? exercise) => - (super.noSuchMethod(Invocation.method(#fetchLogData, [workout, exercise]), - returnValue: Future>.value({})) - as _i14.Future>); - @override - _i14.Future fetchAndSetRepetitionUnits() => - (super.noSuchMethod(Invocation.method(#fetchAndSetRepetitionUnits, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i14.Future); - @override - _i14.Future fetchAndSetWeightUnits() => - (super.noSuchMethod(Invocation.method(#fetchAndSetWeightUnits, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i14.Future); - @override - _i14.Future fetchAndSetUnits() => - (super.noSuchMethod(Invocation.method(#fetchAndSetUnits, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i14.Future); - @override - _i14.Future<_i7.Day> addDay(_i7.Day? day, _i6.WorkoutPlan? workout) => - (super.noSuchMethod(Invocation.method(#addDay, [day, workout]), - returnValue: Future<_i7.Day>.value(_FakeDay())) as _i14.Future<_i7.Day>); - @override - _i14.Future editDay(_i7.Day? day) => (super.noSuchMethod(Invocation.method(#editDay, [day]), + _i13.Future fetchAndSetAllPlansFull() => (super.noSuchMethod( + Invocation.method(#fetchAndSetAllPlansFull, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i14.Future); + returnValueForMissingStub: Future.value()) as _i13.Future); @override - _i14.Future deleteDay(_i7.Day? day) => - (super.noSuchMethod(Invocation.method(#deleteDay, [day]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i14.Future); + _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( + Invocation.method(#fetchAndSetAllPlansSparse, []), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override - _i14.Future<_i8.Set> addSet(_i8.Set? workoutSet) => + _i13.Future<_i6.WorkoutPlan> fetchAndSetPlanSparse(int? planId) => + (super.noSuchMethod(Invocation.method(#fetchAndSetPlanSparse, [planId]), + returnValue: Future<_i6.WorkoutPlan>.value(_FakeWorkoutPlan_4())) + as _i13.Future<_i6.WorkoutPlan>); + @override + _i13.Future<_i6.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) => + (super.noSuchMethod( + Invocation.method(#fetchAndSetWorkoutPlanFull, [workoutId]), + returnValue: Future<_i6.WorkoutPlan>.value(_FakeWorkoutPlan_4())) + as _i13.Future<_i6.WorkoutPlan>); + @override + _i13.Future<_i6.WorkoutPlan> addWorkout(_i6.WorkoutPlan? workout) => + (super.noSuchMethod(Invocation.method(#addWorkout, [workout]), + returnValue: Future<_i6.WorkoutPlan>.value(_FakeWorkoutPlan_4())) + as _i13.Future<_i6.WorkoutPlan>); + @override + _i13.Future editWorkout(_i6.WorkoutPlan? workout) => + (super.noSuchMethod(Invocation.method(#editWorkout, [workout]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) + as _i13.Future); + @override + _i13.Future deleteWorkout(int? id) => (super.noSuchMethod( + Invocation.method(#deleteWorkout, [id]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); + @override + _i13.Future> fetchLogData( + _i6.WorkoutPlan? workout, _i14.Exercise? exercise) => + (super.noSuchMethod(Invocation.method(#fetchLogData, [workout, exercise]), + returnValue: + Future>.value({})) + as _i13.Future>); + @override + _i13.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( + Invocation.method(#fetchAndSetRepetitionUnits, []), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); + @override + _i13.Future fetchAndSetWeightUnits() => (super.noSuchMethod( + Invocation.method(#fetchAndSetWeightUnits, []), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); + @override + _i13.Future fetchAndSetUnits() => (super.noSuchMethod( + Invocation.method(#fetchAndSetUnits, []), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); + @override + _i13.Future<_i7.Day> addDay(_i7.Day? day, _i6.WorkoutPlan? workout) => + (super.noSuchMethod(Invocation.method(#addDay, [day, workout]), + returnValue: Future<_i7.Day>.value(_FakeDay_5())) + as _i13.Future<_i7.Day>); + @override + _i13.Future editDay(_i7.Day? day) => (super.noSuchMethod( + Invocation.method(#editDay, [day]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); + @override + _i13.Future deleteDay(_i7.Day? day) => (super.noSuchMethod( + Invocation.method(#deleteDay, [day]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); + @override + _i13.Future<_i8.Set> addSet(_i8.Set? workoutSet) => (super.noSuchMethod(Invocation.method(#addSet, [workoutSet]), - returnValue: Future<_i8.Set>.value(_FakeSet())) as _i14.Future<_i8.Set>); + returnValue: Future<_i8.Set>.value(_FakeSet_6())) + as _i13.Future<_i8.Set>); @override - _i14.Future editSet(_i8.Set? workoutSet) => - (super.noSuchMethod(Invocation.method(#editSet, [workoutSet]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i14.Future); + _i13.Future editSet(_i8.Set? workoutSet) => (super.noSuchMethod( + Invocation.method(#editSet, [workoutSet]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override - _i14.Future> reorderSets(List<_i8.Set>? sets, int? startIndex) => + _i13.Future> reorderSets( + List<_i8.Set>? sets, int? startIndex) => (super.noSuchMethod(Invocation.method(#reorderSets, [sets, startIndex]), - returnValue: Future>.value(<_i8.Set>[])) as _i14.Future>); + returnValue: Future>.value(<_i8.Set>[])) + as _i13.Future>); @override - _i14.Future fetchComputedSettings(_i8.Set? workoutSet) => - (super.noSuchMethod(Invocation.method(#fetchComputedSettings, [workoutSet]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i14.Future); + _i13.Future fetchComputedSettings(_i8.Set? workoutSet) => (super + .noSuchMethod(Invocation.method(#fetchComputedSettings, [workoutSet]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) + as _i13.Future); @override - _i14.Future fetchSmartText(_i8.Set? workoutSet, _i15.Exercise? exercise) => - (super.noSuchMethod(Invocation.method(#fetchSmartText, [workoutSet, exercise]), - returnValue: Future.value('')) as _i14.Future); + _i13.Future fetchSmartText( + _i8.Set? workoutSet, _i14.Exercise? exercise) => + (super.noSuchMethod( + Invocation.method(#fetchSmartText, [workoutSet, exercise]), + returnValue: Future.value('')) as _i13.Future); @override - _i14.Future deleteSet(_i8.Set? workoutSet) => - (super.noSuchMethod(Invocation.method(#deleteSet, [workoutSet]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i14.Future); + _i13.Future deleteSet(_i8.Set? workoutSet) => (super.noSuchMethod( + Invocation.method(#deleteSet, [workoutSet]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override - _i14.Future<_i9.Setting> addSetting(_i9.Setting? workoutSetting) => + _i13.Future<_i9.Setting> addSetting(_i9.Setting? workoutSetting) => (super.noSuchMethod(Invocation.method(#addSetting, [workoutSetting]), - returnValue: Future<_i9.Setting>.value(_FakeSetting())) as _i14.Future<_i9.Setting>); + returnValue: Future<_i9.Setting>.value(_FakeSetting_7())) + as _i13.Future<_i9.Setting>); @override - _i14.Future fetchSessionData() => + _i13.Future fetchSessionData() => (super.noSuchMethod(Invocation.method(#fetchSessionData, []), - returnValue: Future.value()) as _i14.Future); + returnValue: Future.value()) as _i13.Future); @override - _i14.Future<_i10.WorkoutSession> addSession(_i10.WorkoutSession? session) => + _i13.Future<_i10.WorkoutSession> addSession(_i10.WorkoutSession? session) => (super.noSuchMethod(Invocation.method(#addSession, [session]), - returnValue: Future<_i10.WorkoutSession>.value(_FakeWorkoutSession())) - as _i14.Future<_i10.WorkoutSession>); + returnValue: + Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8())) + as _i13.Future<_i10.WorkoutSession>); @override - _i14.Future<_i11.Log> addLog(_i11.Log? log) => + _i13.Future<_i11.Log> addLog(_i11.Log? log) => (super.noSuchMethod(Invocation.method(#addLog, [log]), - returnValue: Future<_i11.Log>.value(_FakeLog())) as _i14.Future<_i11.Log>); + returnValue: Future<_i11.Log>.value(_FakeLog_9())) + as _i13.Future<_i11.Log>); @override - void addListener(_i16.VoidCallback? listener) => super - .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); + Uri makeUrl(String? path, + {int? id, String? objectMethod, Map? query}) => + (super.noSuchMethod( + Invocation.method(#makeUrl, [path], + {#id: id, #objectMethod: objectMethod, #query: query}), + returnValue: _FakeUri_10()) as Uri); @override - void removeListener(_i16.VoidCallback? listener) => + _i13.Future> fetch(Uri? uri) => (super.noSuchMethod( + Invocation.method(#fetch, [uri]), + returnValue: Future>.value({})) + as _i13.Future>); + @override + _i13.Future> post( + Map? data, Uri? uri) => + (super.noSuchMethod(Invocation.method(#post, [data, uri]), + returnValue: + Future>.value({})) + as _i13.Future>); + @override + _i13.Future> patch( + Map? data, Uri? uri) => + (super.noSuchMethod(Invocation.method(#patch, [data, uri]), + returnValue: + Future>.value({})) + as _i13.Future>); + @override + _i13.Future<_i5.Response> deleteRequest(String? url, int? id) => + (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), + returnValue: Future<_i5.Response>.value(_FakeResponse_11())) + as _i13.Future<_i5.Response>); + @override + String toString() => super.toString(); + @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); + void dispose() => super.noSuchMethod(Invocation.method(#dispose, []), + returnValueForMissingStub: null); @override void notifyListeners() => - super.noSuchMethod(Invocation.method(#notifyListeners, []), returnValueForMissingStub: null); - @override - Uri makeUrl(String? path, {int? id, String? objectMethod, Map? query}) => - (super.noSuchMethod( - Invocation.method( - #makeUrl, [path], {#id: id, #objectMethod: objectMethod, #query: query}), - returnValue: _FakeUri()) as Uri); - @override - _i14.Future> fetch(Uri? uri) => - (super.noSuchMethod(Invocation.method(#fetch, [uri]), - returnValue: Future>.value({})) - as _i14.Future>); - @override - _i14.Future> post(Map? data, Uri? uri) => - (super.noSuchMethod(Invocation.method(#post, [data, uri]), - returnValue: Future>.value({})) - as _i14.Future>); - @override - _i14.Future> patch(Map? data, Uri? uri) => - (super.noSuchMethod(Invocation.method(#patch, [data, uri]), - returnValue: Future>.value({})) - as _i14.Future>); - @override - _i14.Future<_i12.Response> deleteRequest(String? url, int? id) => - (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), - returnValue: Future<_i12.Response>.value(_FakeResponse())) as _i14.Future<_i12.Response>); + super.noSuchMethod(Invocation.method(#notifyListeners, []), + returnValueForMissingStub: null); } diff --git a/test/workout_set_form_test.mocks.dart b/test/workout_set_form_test.mocks.dart index c153d037..704eecf4 100644 --- a/test/workout_set_form_test.mocks.dart +++ b/test/workout_set_form_test.mocks.dart @@ -1,132 +1,144 @@ -// Mocks generated by Mockito 5.0.10 from annotations +// Mocks generated by Mockito 5.0.15 from annotations // in wger/test/workout_set_form_test.dart. // Do not manually edit this file. -import 'dart:async' as _i7; -import 'dart:ui' as _i8; +import 'dart:async' as _i6; +import 'dart:ui' as _i7; -import 'package:http/src/client.dart' as _i3; -import 'package:http/src/response.dart' as _i5; +import 'package:http/http.dart' as _i3; import 'package:mockito/mockito.dart' as _i1; import 'package:wger/models/exercises/exercise.dart' as _i4; import 'package:wger/providers/auth.dart' as _i2; -import 'package:wger/providers/exercises.dart' as _i6; +import 'package:wger/providers/exercises.dart' as _i5; // 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 -class _FakeAuthProvider extends _i1.Fake implements _i2.AuthProvider {} +class _FakeAuthProvider_0 extends _i1.Fake implements _i2.AuthProvider {} -class _FakeClient extends _i1.Fake implements _i3.Client {} +class _FakeClient_1 extends _i1.Fake implements _i3.Client {} -class _FakeExercise extends _i1.Fake implements _i4.Exercise {} +class _FakeExercise_2 extends _i1.Fake implements _i4.Exercise {} -class _FakeUri extends _i1.Fake implements Uri { - @override - String toString() => super.toString(); -} +class _FakeUri_3 extends _i1.Fake implements Uri {} -class _FakeResponse extends _i1.Fake implements _i5.Response {} +class _FakeResponse_4 extends _i1.Fake implements _i3.Response {} /// A class which mocks [ExercisesProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockExercisesProvider extends _i1.Mock implements _i6.ExercisesProvider { +class MockExercisesProvider extends _i1.Mock implements _i5.ExercisesProvider { MockExercisesProvider() { _i1.throwOnMissingStub(this); } @override - List<_i4.Exercise> get items => - (super.noSuchMethod(Invocation.getter(#items), returnValue: <_i4.Exercise>[]) - as List<_i4.Exercise>); + List<_i4.Exercise> get items => (super.noSuchMethod(Invocation.getter(#items), + returnValue: <_i4.Exercise>[]) as List<_i4.Exercise>); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); - @override - _i2.AuthProvider get auth => - (super.noSuchMethod(Invocation.getter(#auth), returnValue: _FakeAuthProvider()) - as _i2.AuthProvider); + _i2.AuthProvider get auth => (super.noSuchMethod(Invocation.getter(#auth), + returnValue: _FakeAuthProvider_0()) as _i2.AuthProvider); @override set auth(_i2.AuthProvider? _auth) => - super.noSuchMethod(Invocation.setter(#auth, _auth), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#auth, _auth), + returnValueForMissingStub: null); @override - _i3.Client get client => - (super.noSuchMethod(Invocation.getter(#client), returnValue: _FakeClient()) as _i3.Client); + _i3.Client get client => (super.noSuchMethod(Invocation.getter(#client), + returnValue: _FakeClient_1()) as _i3.Client); @override set client(_i3.Client? _client) => - super.noSuchMethod(Invocation.setter(#client, _client), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#client, _client), + returnValueForMissingStub: null); + @override + bool get hasListeners => + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override _i4.Exercise findById(int? exerciseId) => - (super.noSuchMethod(Invocation.method(#findById, [exerciseId]), returnValue: _FakeExercise()) - as _i4.Exercise); + (super.noSuchMethod(Invocation.method(#findById, [exerciseId]), + returnValue: _FakeExercise_2()) as _i4.Exercise); @override - _i7.Future fetchAndSetCategories() => + _i6.Future fetchAndSetCategories() => (super.noSuchMethod(Invocation.method(#fetchAndSetCategories, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i7.Future); + returnValueForMissingStub: Future.value()) as _i6.Future); @override - _i7.Future fetchAndSetMuscles() => + _i6.Future fetchAndSetMuscles() => (super.noSuchMethod(Invocation.method(#fetchAndSetMuscles, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i7.Future); + returnValueForMissingStub: Future.value()) as _i6.Future); @override - _i7.Future fetchAndSetEquipment() => + _i6.Future fetchAndSetEquipment() => (super.noSuchMethod(Invocation.method(#fetchAndSetEquipment, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i7.Future); + returnValueForMissingStub: Future.value()) as _i6.Future); @override - _i7.Future<_i4.Exercise> fetchAndSetExercise(int? exerciseId) => + _i6.Future<_i4.Exercise> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod(Invocation.method(#fetchAndSetExercise, [exerciseId]), - returnValue: Future<_i4.Exercise>.value(_FakeExercise())) as _i7.Future<_i4.Exercise>); + returnValue: Future<_i4.Exercise>.value(_FakeExercise_2())) + as _i6.Future<_i4.Exercise>); @override - _i7.Future fetchAndSetExercises() => + _i6.Future fetchAndSetExercises() => (super.noSuchMethod(Invocation.method(#fetchAndSetExercises, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i7.Future); + returnValueForMissingStub: Future.value()) as _i6.Future); @override - _i7.Future> searchExercise(String? name, [String? languageCode = r'en']) => - (super.noSuchMethod(Invocation.method(#searchExercise, [name, languageCode]), - returnValue: Future>.value([])) as _i7.Future>); + _i6.Future> searchExercise(String? name, + [String? languageCode = r'en']) => + (super.noSuchMethod( + Invocation.method(#searchExercise, [name, languageCode]), + returnValue: Future>.value([])) + as _i6.Future>); @override - void addListener(_i8.VoidCallback? listener) => super - .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); + Uri makeUrl(String? path, + {int? id, String? objectMethod, Map? query}) => + (super.noSuchMethod( + Invocation.method(#makeUrl, [path], + {#id: id, #objectMethod: objectMethod, #query: query}), + returnValue: _FakeUri_3()) as Uri); @override - void removeListener(_i8.VoidCallback? listener) => + _i6.Future> fetch(Uri? uri) => (super.noSuchMethod( + Invocation.method(#fetch, [uri]), + returnValue: Future>.value({})) + as _i6.Future>); + @override + _i6.Future> post(Map? data, Uri? uri) => + (super.noSuchMethod(Invocation.method(#post, [data, uri]), + returnValue: + Future>.value({})) + as _i6.Future>); + @override + _i6.Future> patch( + Map? data, Uri? uri) => + (super.noSuchMethod(Invocation.method(#patch, [data, uri]), + returnValue: + Future>.value({})) + as _i6.Future>); + @override + _i6.Future<_i3.Response> deleteRequest(String? url, int? id) => + (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), + returnValue: Future<_i3.Response>.value(_FakeResponse_4())) + as _i6.Future<_i3.Response>); + @override + String toString() => super.toString(); + @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); + void dispose() => super.noSuchMethod(Invocation.method(#dispose, []), + returnValueForMissingStub: null); @override void notifyListeners() => - super.noSuchMethod(Invocation.method(#notifyListeners, []), returnValueForMissingStub: null); - @override - Uri makeUrl(String? path, {int? id, String? objectMethod, Map? query}) => - (super.noSuchMethod( - Invocation.method( - #makeUrl, [path], {#id: id, #objectMethod: objectMethod, #query: query}), - returnValue: _FakeUri()) as Uri); - @override - _i7.Future> fetch(Uri? uri) => - (super.noSuchMethod(Invocation.method(#fetch, [uri]), - returnValue: Future>.value({})) - as _i7.Future>); - @override - _i7.Future> post(Map? data, Uri? uri) => - (super.noSuchMethod(Invocation.method(#post, [data, uri]), - returnValue: Future>.value({})) - as _i7.Future>); - @override - _i7.Future> patch(Map? data, Uri? uri) => - (super.noSuchMethod(Invocation.method(#patch, [data, uri]), - returnValue: Future>.value({})) - as _i7.Future>); - @override - _i7.Future<_i5.Response> deleteRequest(String? url, int? id) => - (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), - returnValue: Future<_i5.Response>.value(_FakeResponse())) as _i7.Future<_i5.Response>); + super.noSuchMethod(Invocation.method(#notifyListeners, []), + returnValueForMissingStub: null); }