From 24e031d595d7fe826494b9332d08ba22bfaf1829 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 9 Jan 2024 15:00:36 +0100 Subject: [PATCH] Finally fix the tests We now dependency inject the database for the whole exercise provider, this makes our lives a bit easier --- lib/core/locator.dart | 17 +- .../ingredients/ingredients_database.dart | 3 + lib/providers/exercises.dart | 11 +- pubspec.lock | 252 ++++--- test/exercises/exercise_provider_db_test.dart | 5 +- .../exercise_provider_load_test.dart | 34 +- test/exercises/exercise_provider_test.dart | 25 +- test/workout/gym_mode_screen_test.mocks.dart | 344 ++++----- test/workout/workout_plan_screen_test.dart | 7 +- test/workout/workout_plans_screen_test.dart | 7 +- test/workout/workout_provider_test.dart | 6 + test/workout/workout_set_form_test.mocks.dart | 660 +++++++++--------- 12 files changed, 738 insertions(+), 633 deletions(-) diff --git a/lib/core/locator.dart b/lib/core/locator.dart index f9d131c2..62aeef7e 100644 --- a/lib/core/locator.dart +++ b/lib/core/locator.dart @@ -1,5 +1,7 @@ import 'dart:developer'; +import 'dart:io'; +import 'package:drift/native.dart'; import 'package:get_it/get_it.dart'; import 'package:wger/database/exercises/exercise_database.dart'; import 'package:wger/database/ingredients/ingredients_database.dart'; @@ -14,8 +16,19 @@ class ServiceLocator { static final ServiceLocator _singleton = ServiceLocator._internal(); Future _initDB() async { - final exerciseDB = ExerciseDatabase(); - final ingredientDB = IngredientDatabase(); + ExerciseDatabase exerciseDB; + IngredientDatabase ingredientDB; + // final exerciseDB = ExerciseDatabase(); + // final ingredientDB = IngredientDatabase(); + + if (Platform.environment.containsKey('FLUTTER_TEST')) { + exerciseDB = ExerciseDatabase.inMemory(NativeDatabase.memory()); + ingredientDB = IngredientDatabase.inMemory(NativeDatabase.memory()); + } else { + exerciseDB = ExerciseDatabase(); + ingredientDB = IngredientDatabase(); + } + locator.registerSingleton(exerciseDB); locator.registerSingleton(ingredientDB); } diff --git a/lib/database/ingredients/ingredients_database.dart b/lib/database/ingredients/ingredients_database.dart index de1888f9..12e97cd0 100644 --- a/lib/database/ingredients/ingredients_database.dart +++ b/lib/database/ingredients/ingredients_database.dart @@ -20,6 +20,9 @@ class Ingredients extends Table { class IngredientDatabase extends _$IngredientDatabase { IngredientDatabase() : super(_openConnection()); + // Named constructor for creating in-memory database + IngredientDatabase.inMemory(super.e); + @override // TODO: implement schemaVersion int get schemaVersion => 1; diff --git a/lib/providers/exercises.dart b/lib/providers/exercises.dart index b72cf2b1..6caa0277 100644 --- a/lib/providers/exercises.dart +++ b/lib/providers/exercises.dart @@ -37,8 +37,11 @@ import 'package:wger/providers/base_provider.dart'; class ExercisesProvider with ChangeNotifier { final WgerBaseProvider baseProvider; + late ExerciseDatabase database; - ExercisesProvider(this.baseProvider); + ExercisesProvider(this.baseProvider, {ExerciseDatabase? database}) { + this.database = database ?? locator(); + } static const EXERCISE_CACHE_DAYS = 7; static const EXERCISE_FETCH_HOURS = 4; @@ -265,7 +268,7 @@ class ExercisesProvider with ChangeNotifier { /// /// If the exercise is not known locally, it is fetched from the server. Future fetchAndSetExercise(int exerciseId) async { - final database = locator(); + //final database = locator(); try { final exercise = findExerciseById(exerciseId); @@ -360,7 +363,6 @@ class ExercisesProvider with ChangeNotifier { /// can change and we need to invalidate it as a result Future checkExerciseCacheVersion() async { final prefs = await SharedPreferences.getInstance(); - final database = locator(); if (prefs.containsKey(PREFS_EXERCISE_CACHE_VERSION)) { final cacheVersion = prefs.getInt(PREFS_EXERCISE_CACHE_VERSION)!; @@ -407,7 +409,6 @@ class ExercisesProvider with ChangeNotifier { } Future clearAllCachesAndPrefs() async { - final database = locator(); await database.deleteEverything(); await initCacheTimesLocalPrefs(forceInit: true); } @@ -422,8 +423,6 @@ class ExercisesProvider with ChangeNotifier { Future fetchAndSetInitialData() async { clear(); - final database = locator(); - await initCacheTimesLocalPrefs(); await checkExerciseCacheVersion(); diff --git a/pubspec.lock b/pubspec.lock index 309b34a4..16512edf 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,26 +5,26 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a + sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 url: "https://pub.dev" source: hosted - version: "61.0.0" + version: "64.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 + sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" url: "https://pub.dev" source: hosted - version: "5.13.0" + version: "6.2.0" analyzer_plugin: dependency: transitive description: name: analyzer_plugin - sha256: c1d5f167683de03d5ab6c3b53fc9aeefc5d59476e7810ba7bbddff50c6f4392d + sha256: "9661b30b13a685efaee9f02e5d01ed9f2b423bd889d28a304d02d704aee69161" url: "https://pub.dev" source: hosted - version: "0.11.2" + version: "0.11.3" android_metadata: dependency: "direct main" description: @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: archive - sha256: "7b875fd4a20b165a3084bd2d210439b22ebc653f21cea4842729c0c30c82596b" + sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" url: "https://pub.dev" source: hosted - version: "3.4.9" + version: "3.4.10" args: dependency: transitive description: @@ -93,18 +93,18 @@ packages: dependency: transitive description: name: build_resolvers - sha256: "64e12b0521812d1684b1917bc80945625391cb9bdd4312536b1d69dcb6133ed8" + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.4.2" build_runner: dependency: "direct dev" description: name: build_runner - sha256: "10c6bcdbf9d049a0b666702cf1cee4ddfdc38f02a19d35ae392863b47519848b" + sha256: "67d591d602906ef9201caf93452495ad1812bea2074f04e25dbd7c133785821b" url: "https://pub.dev" source: hosted - version: "2.4.6" + version: "2.4.7" build_runner_core: dependency: transitive description: @@ -125,50 +125,50 @@ packages: dependency: transitive description: name: built_value - sha256: "723b4021e903217dfc445ec4cf5b42e27975aece1fc4ebbc1ca6329c2d9fb54e" + sha256: c9aabae0718ec394e5bc3c7272e6bb0dc0b32201a08fe185ec1d8401d3e39309 url: "https://pub.dev" source: hosted - version: "8.7.0" + version: "8.8.1" camera: dependency: transitive description: name: camera - sha256: "1f9010f0689774380fbcd7d6b7820a5157e8e97685fa66d619e1d1f58b3fdf93" + sha256: "9499cbc2e51d8eb0beadc158b288380037618ce4e30c9acbc4fae1ac3ecb5797" url: "https://pub.dev" source: hosted - version: "0.10.5+5" + version: "0.10.5+9" camera_android: dependency: transitive description: name: camera_android - sha256: "58463140f1b39591b8e2155861b436abad4ceb48160058be8374164ff0309ef3" + sha256: "351429510121d179b9aac5a2e8cb525c3cd6c39f4d709c5f72dfb21726e52371" url: "https://pub.dev" source: hosted - version: "0.10.8+13" + version: "0.10.8+16" camera_avfoundation: dependency: transitive description: name: camera_avfoundation - sha256: "3b6d9f550cfd658c71f34a99509528501e5e5d4fa79f11e3a4d6ef380d8e0254" + sha256: "1408600aa45faad05c518afccaabcd58419412ab67755a405b2ddce4f93fa120" url: "https://pub.dev" source: hosted - version: "0.9.13+7" + version: "0.9.13+9" camera_platform_interface: dependency: transitive description: name: camera_platform_interface - sha256: "86fd4fc597c6e455265ddb5884feb352d0171ad14b9cdf3aba30da59b25738c4" + sha256: e971ebca970f7cfee396f76ef02070b5e441b4aa04942da9c108d725f57bbd32 url: "https://pub.dev" source: hosted - version: "2.6.0" + version: "2.7.2" camera_web: dependency: transitive description: name: camera_web - sha256: d4c2c571c7af04f8b10702ca16bb9ed2a26e64534171e8f75c9349b2c004d8f1 + sha256: f18ccfb33b2a7c49a52ad5aa3f07330b7422faaecbdfd9b9fe8e51182f6ad67d url: "https://pub.dev" source: hosted - version: "0.3.2+3" + version: "0.3.2+4" carousel_slider: dependency: "direct main" description: @@ -213,18 +213,18 @@ packages: dependency: "direct dev" description: name: cider - sha256: "918ded9f4473d8042247b9e66a90101eb5ff72935c31df5d511a55f14e085ef0" + sha256: "2d449e99f0c2db791bfcbf013a3c2f7c0ef48c0085d8340686ff25ce8b94fd9b" url: "https://pub.dev" source: hosted - version: "0.2.4" + version: "0.2.5" cli_util: dependency: transitive description: name: cli_util - sha256: b8db3080e59b2503ca9e7922c3df2072cf13992354d5e944074ffa836fba43b7 + sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19 url: "https://pub.dev" source: hosted - version: "0.4.0" + version: "0.4.1" clock: dependency: transitive description: @@ -237,10 +237,10 @@ packages: dependency: transitive description: name: code_builder - sha256: "1be9be30396d7e4c0db42c35ea6ccd7cc6a1e19916b5dc64d6ac216b5544d677" + sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 url: "https://pub.dev" source: hosted - version: "4.7.0" + version: "4.10.0" collection: dependency: "direct main" description: @@ -261,10 +261,10 @@ packages: dependency: transitive description: name: cross_file - sha256: "445db18de832dba8d851e287aff8ccf169bed30d2e94243cb54c7d2f1ed2142c" + sha256: fedaadfa3a6996f75211d835aaeb8fede285dae94262485698afd832371b9a5e url: "https://pub.dev" source: hosted - version: "0.3.3+6" + version: "0.3.3+8" crypto: dependency: transitive description: @@ -293,26 +293,26 @@ packages: dependency: transitive description: name: dart_style - sha256: "1efa911ca7086affd35f463ca2fc1799584fb6aa89883cf0af8e3664d6a02d55" + sha256: "40ae61a5d43feea6d24bd22c0537a6629db858963b99b4bc1c3db80676f32368" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.4" drift: dependency: "direct main" description: name: drift - sha256: ef2ddafe89c1f5f26767e5eada65d739de4e9d2820303f7249f15a005999d5fc + sha256: "05363b695885c72036ed5c76287125bfc6f1deda20cb3aa044a09fe22792f81b" url: "https://pub.dev" source: hosted - version: "2.13.1" + version: "2.14.1" drift_dev: dependency: "direct dev" description: name: drift_dev - sha256: f79281f13411abe4229d6b57956202f047cc49b2c4e0d26ffae7273d6e5e97b1 + sha256: "50c14b8248d133d36b41c1b08ceed138be869b5b98ccaf3af16c9b88c7adc54e" url: "https://pub.dev" source: hosted - version: "2.13.1" + version: "2.14.1" equatable: dependency: "direct main" description: @@ -365,10 +365,10 @@ packages: dependency: transitive description: name: file_selector_platform_interface - sha256: "0aa47a725c346825a2bd396343ce63ac00bda6eff2fbc43eabe99737dede8262" + sha256: a3994c26f10378a039faa11de174d7b78eb8f79e4dd0af2a451410c1a5c3f66b url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "2.6.2" file_selector_windows: dependency: transitive description: @@ -550,10 +550,10 @@ packages: dependency: "direct main" description: name: flutter_zxing - sha256: "748fbd181d58335cefb0168f270c8fc5977f16bc1b2f90eb7658784e37f6e9f2" + sha256: ed8da1a0e4650c7645e94b5ab92f855a6b628385d815641761ccbdcaee131683 url: "https://pub.dev" source: hosted - version: "1.4.1" + version: "1.5.2" font_awesome_flutter: dependency: "direct main" description: @@ -566,10 +566,10 @@ packages: dependency: "direct dev" description: name: freezed - sha256: "21bf2825311de65501d22e563e3d7605dff57fb5e6da982db785ae5372ff018a" + sha256: "6c5031daae12c7072b3a87eff98983076434b4889ef2a44384d0cae3f82372ba" url: "https://pub.dev" source: hosted - version: "2.4.5" + version: "2.4.6" freezed_annotation: dependency: "direct main" description: @@ -595,10 +595,10 @@ packages: dependency: "direct main" description: name: get_it - sha256: f79870884de16d689cf9a7d15eedf31ed61d750e813c538a6efb92660fea83c3 + sha256: d0b88dc35a7f97fd91fec0cf8f165abd97a57977968d8fc02ba0bc92e14ba07e url: "https://pub.dev" source: hosted - version: "7.6.4" + version: "7.6.6" glob: dependency: transitive description: @@ -627,10 +627,10 @@ packages: dependency: "direct main" description: name: http - sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" + sha256: d4872660c46d929f6b8a9ef4e7a7eff7e49bbf0c4ec3f385ee32df5119175139 url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.2" http_multi_server: dependency: transitive description: @@ -659,34 +659,34 @@ packages: dependency: "direct main" description: name: image_picker - sha256: "7d7f2768df2a8b0a3cefa5ef4f84636121987d403130e70b17ef7e2cf650ba84" + sha256: "26222b01a0c9a2c8fe02fc90b8208bd3325da5ed1f4a2acabf75939031ac0bdd" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.0.7" image_picker_android: dependency: transitive description: name: image_picker_android - sha256: d6a6e78821086b0b737009b09363018309bbc6de3fd88cc5c26bc2bb44a4957f + sha256: "1a27bf4cc0330389cebe465bab08fe6dec97e44015b4899637344bb7297759ec" url: "https://pub.dev" source: hosted - version: "0.8.8+2" + version: "0.8.9+2" image_picker_for_web: dependency: transitive description: name: image_picker_for_web - sha256: "50bc9ae6a77eea3a8b11af5eb6c661eeb858fdd2f734c2a4fd17086922347ef7" + sha256: e2423c53a68b579a7c37a1eda967b8ae536c3d98518e5db95ca1fe5719a730a3 url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" image_picker_ios: dependency: transitive description: name: image_picker_ios - sha256: "76ec722aeea419d03aa915c2c96bf5b47214b053899088c9abb4086ceecf97a7" + sha256: eac0a62104fa12feed213596df0321f57ce5a572562f72a68c4ff81e9e4caacf url: "https://pub.dev" source: hosted - version: "0.8.8+4" + version: "0.8.9" image_picker_linux: dependency: transitive description: @@ -707,10 +707,10 @@ packages: dependency: transitive description: name: image_picker_platform_interface - sha256: ed9b00e63977c93b0d2d2b343685bed9c324534ba5abafbb3dfbd6a780b1b514 + sha256: fa4e815e6fcada50e35718727d83ba1c92f1edf95c0b4436554cec301b56233b url: "https://pub.dev" source: hosted - version: "2.9.1" + version: "2.9.3" image_picker_windows: dependency: transitive description: @@ -840,10 +840,10 @@ packages: dependency: "direct dev" description: name: mockito - sha256: "4b693867cee1853c9d1d7ecc1871f27f39b2ef2c13c0d8d8507dfe5bebd8aaf1" + sha256: "6841eed20a7befac0ce07df8116c8b8233ed1f4486a7647c7fc5a02ae6163917" url: "https://pub.dev" source: hosted - version: "5.4.3" + version: "5.4.4" multi_select_flutter: dependency: "direct main" description: @@ -912,18 +912,18 @@ packages: dependency: "direct main" description: name: path_provider - sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa + sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72 + sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.2.2" path_provider_foundation: dependency: transitive description: @@ -944,10 +944,10 @@ packages: dependency: transitive description: name: path_provider_platform_interface - sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" path_provider_windows: dependency: transitive description: @@ -960,10 +960,10 @@ packages: dependency: transitive description: name: petitparser - sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 url: "https://pub.dev" source: hosted - version: "5.4.0" + version: "6.0.2" platform: dependency: transitive description: @@ -976,10 +976,10 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.6" + version: "2.1.8" pointer_interceptor: dependency: transitive description: @@ -1036,14 +1036,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.3" - quiver: - dependency: transitive - description: - name: quiver - sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47 - url: "https://pub.dev" - source: hosted - version: "3.2.1" recase: dependency: transitive description: @@ -1064,10 +1056,10 @@ packages: dependency: "direct main" description: name: rive - sha256: fd15b219f5cc110285ebf52093b0b0f4038c3ca750f2fc5fc44d9c80a56c44f3 + sha256: ae75a6e9cfbf146630bfb1feba97ee582d935508be6b362e4bd197b9c55a6dd3 url: "https://pub.dev" source: hosted - version: "0.12.3" + version: "0.12.4" rive_common: dependency: transitive description: @@ -1112,18 +1104,18 @@ packages: dependency: transitive description: name: shared_preferences_platform_interface - sha256: d4ec5fc9ebb2f2e056c617112aa75dcf92fc2e4faaf2ae999caa297473f75d8a + sha256: "22e2ecac9419b4246d7c22bfbbda589e3acf5c0351137d87dd2939d984d37c3b" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.2" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf + sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.2.2" shared_preferences_windows: dependency: transitive description: @@ -1165,10 +1157,10 @@ packages: dependency: transitive description: name: source_gen - sha256: fc0da689e5302edb6177fdd964efcb7f58912f43c28c2047a808f5bfff643d16 + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.5.0" source_helper: dependency: transitive description: @@ -1189,10 +1181,10 @@ packages: dependency: transitive description: name: sqlite3 - sha256: db65233e6b99e99b2548932f55a987961bc06d82a31a0665451fa0b4fff4c3fb + sha256: c4a4c5a4b2a32e2d0f6837b33d7c91a67903891a5b7dbe706cf4b1f6b0c798c5 url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.3.0" sqlite3_flutter_libs: dependency: "direct main" description: @@ -1205,10 +1197,10 @@ packages: dependency: transitive description: name: sqlparser - sha256: db6354e8ba71acc50bc4afeafff2a248710ae2c00c9412e2c8b796916d4b1c45 + sha256: "877fcefabb725d120e31f54fa669a98c002db0feeaca6cea5354543f03b5e906" url: "https://pub.dev" source: hosted - version: "0.32.1" + version: "0.33.0" stack_trace: dependency: transitive description: @@ -1293,34 +1285,34 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: b1c9e98774adf8820c96fbc7ae3601231d324a7d5ebd8babe27b6dfac91357ba + sha256: d25bb0ca00432a5e1ee40e69c36c85863addf7cc45e433769d61bed3fe81fd96 url: "https://pub.dev" source: hosted - version: "6.2.1" + version: "6.2.3" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: "31222ffb0063171b526d3e569079cf1f8b294075ba323443fdc690842bfd4def" + sha256: "507dc655b1d9cb5ebc756032eb785f114e415f91557b73bf60b7e201dfedeb2f" url: "https://pub.dev" source: hosted - version: "6.2.0" + version: "6.2.2" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: "4ac97281cf60e2e8c5cc703b2b28528f9b50c8f7cebc71df6bdf0845f647268a" + sha256: cdb7b6da34483f9b2c9f8b2b29bc468fa7271d92e2021607ca0c4d3bcb04cdd4 url: "https://pub.dev" source: hosted - version: "6.2.0" + version: "6.2.3" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: "9f2d390e096fdbe1e6e6256f97851e51afc2d9c423d3432f1d6a02a8a9a8b9fd" + sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.1" url_launcher_macos: dependency: transitive description: @@ -1333,50 +1325,50 @@ packages: dependency: transitive description: name: url_launcher_platform_interface - sha256: "980e8d9af422f477be6948bdfb68df8433be71f5743a188968b0c1b887807e50" + sha256: a932c3a8082e118f80a475ce692fde89dc20fddb24c57360b96bc56f7035de1f url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.1" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "7fd2f55fe86cea2897b963e864dc01a7eb0719ecc65fcef4c1cc3d686d718bb2" + sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.2.3" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: "7754a1ad30ee896b265f8d14078b0513a4dba28d358eabb9d5f339886f4a1adc" + sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.1" vector_graphics: dependency: transitive description: name: vector_graphics - sha256: "0f0c746dd2d6254a0057218ff980fc7f5670fd0fcf5e4db38a490d31eed4ad43" + sha256: "18f6690295af52d081f6808f2f7c69f0eed6d7e23a71539d75f4aeb8f0062172" url: "https://pub.dev" source: hosted - version: "1.1.9+1" + version: "1.1.9+2" vector_graphics_codec: dependency: transitive description: name: vector_graphics_codec - sha256: "0edf6d630d1bfd5589114138ed8fada3234deacc37966bec033d3047c29248b7" + sha256: "531d20465c10dfac7f5cd90b60bbe4dd9921f1ec4ca54c83ebb176dbacb7bb2d" url: "https://pub.dev" source: hosted - version: "1.1.9+1" + version: "1.1.9+2" vector_graphics_compiler: dependency: transitive description: name: vector_graphics_compiler - sha256: d24333727332d9bd20990f1483af4e09abdb9b1fc7c3db940b56ab5c42790c26 + sha256: "03012b0a33775c5530576b70240308080e1d5050f0faf000118c20e6463bc0ad" url: "https://pub.dev" source: hosted - version: "1.1.9+1" + version: "1.1.9+2" vector_math: dependency: transitive description: @@ -1397,50 +1389,50 @@ packages: dependency: transitive description: name: version_manipulation - sha256: "9ef166939794d5bd80309cc6dbfe33c9f81674ba1c73ac117a866fd2dc746846" + sha256: e90782d610bde19765d2808ec06bc8ed9e04640a4dd07d1a3d370728ce9dae7f url: "https://pub.dev" source: hosted - version: "0.1.2" + version: "0.2.0" video_player: dependency: "direct main" description: name: video_player - sha256: e16f0a83601a78d165dabc17e4dac50997604eb9e4cc76e10fa219046b70cef3 + sha256: fbf28ce8bcfe709ad91b5789166c832cb7a684d14f571a81891858fefb5bb1c2 url: "https://pub.dev" source: hosted - version: "2.8.1" + version: "2.8.2" video_player_android: dependency: transitive description: name: video_player_android - sha256: "3fe89ab07fdbce786e7eb25b58532d6eaf189ceddc091cb66cba712f8d9e8e55" + sha256: "7f8f25d7ad56819a82b2948357f3c3af071f6a678db33833b26ec36bbc221316" url: "https://pub.dev" source: hosted - version: "2.4.10" + version: "2.4.11" video_player_avfoundation: dependency: transitive description: name: video_player_avfoundation - sha256: fe73d636f82286a3739f5e644f95f09442cacdc436ebbe5436521dc915f3ecac + sha256: "752b783a00748684312dd6a68e22f795281d295921e69ae5ad36f90b7fb39cdb" url: "https://pub.dev" source: hosted - version: "2.5.1" + version: "2.5.5" video_player_platform_interface: dependency: transitive description: name: video_player_platform_interface - sha256: be72301bf2c0150ab35a8c34d66e5a99de525f6de1e8d27c0672b836fe48f73a + sha256: "236454725fafcacf98f0f39af0d7c7ab2ce84762e3b63f2cbb3ef9a7e0550bc6" url: "https://pub.dev" source: hosted - version: "6.2.1" + version: "6.2.2" video_player_web: dependency: transitive description: name: video_player_web - sha256: ab7a462b07d9ca80bed579e30fb3bce372468f1b78642e0911b10600f2c5cb5b + sha256: "34beb3a07d4331a24f7e7b2f75b8e2b103289038e07e65529699a671b6a6e2cb" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.3" vm_service: dependency: transitive description: @@ -1485,26 +1477,26 @@ packages: dependency: transitive description: name: win32 - sha256: "350a11abd2d1d97e0cc7a28a81b781c08002aa2864d9e3f192ca0ffa18b06ed3" + sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" url: "https://pub.dev" source: hosted - version: "5.0.9" + version: "5.2.0" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2" + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.4" xml: dependency: transitive description: name: xml - sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84" + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "6.5.0" yaml: dependency: transitive description: @@ -1514,5 +1506,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0-194.0.dev <4.0.0" - flutter: ">=3.13.0" + dart: ">=3.2.0 <4.0.0" + flutter: ">=3.16.0" diff --git a/test/exercises/exercise_provider_db_test.dart b/test/exercises/exercise_provider_db_test.dart index bf1d5081..3f921f91 100644 --- a/test/exercises/exercise_provider_db_test.dart +++ b/test/exercises/exercise_provider_db_test.dart @@ -85,7 +85,10 @@ void main() { setUp(() { mockBaseProvider = MockWgerBaseProvider(); - provider = ExercisesProvider(mockBaseProvider); + provider = ExercisesProvider( + mockBaseProvider, + database: ExerciseDatabase.inMemory(NativeDatabase.memory()), + ); database = ExerciseDatabase.inMemory(NativeDatabase.memory()); WidgetsFlutterBinding.ensureInitialized(); diff --git a/test/exercises/exercise_provider_load_test.dart b/test/exercises/exercise_provider_load_test.dart index e54aea86..d1f20288 100644 --- a/test/exercises/exercise_provider_load_test.dart +++ b/test/exercises/exercise_provider_load_test.dart @@ -1,7 +1,12 @@ import 'dart:convert'; +import 'package:drift/drift.dart'; +import 'package:drift/native.dart'; +import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; +import 'package:wger/core/locator.dart'; +import 'package:wger/database/exercises/exercise_database.dart'; import 'package:wger/models/exercises/exercise.dart'; import 'package:wger/providers/exercises.dart'; @@ -21,13 +26,30 @@ void main() { path: 'api/v2/$exerciseBaseInfoUrl/9/', ); + final Uri tExerciseBaseInfoUri2 = Uri( + scheme: 'http', + host: 'localhost', + path: 'api/v2/$exerciseBaseInfoUrl/1/', + ); + final Map tExerciseInfoMap = jsonDecode( fixture('exercises/exercisebaseinfo_response.json'), ); - setUp(() { + setUpAll(() async { + // Needs to be configured here, setUp runs on every test, setUpAll only once + await ServiceLocator().configure(); + }); + + setUp(() async { + WidgetsFlutterBinding.ensureInitialized(); + driftRuntimeOptions.dontWarnAboutMultipleDatabases = true; + mockBaseProvider = MockWgerBaseProvider(); - provider = ExercisesProvider(mockBaseProvider); + provider = ExercisesProvider( + mockBaseProvider, + database: ExerciseDatabase.inMemory(NativeDatabase.memory()), + ); provider.exercises = getTestExerciseBases(); provider.languages = [tLanguage1, tLanguage2, tLanguage3]; @@ -35,8 +57,14 @@ void main() { when( mockBaseProvider.makeUrl(exerciseBaseInfoUrl, id: 9), ).thenReturn(tExerciseBaseInfoUri); + when( + mockBaseProvider.makeUrl(exerciseBaseInfoUrl, id: 1), + ).thenReturn(tExerciseBaseInfoUri2); + when(mockBaseProvider.fetch(tExerciseBaseInfoUri)) .thenAnswer((_) => Future.value(tExerciseInfoMap)); + when(mockBaseProvider.fetch(tExerciseBaseInfoUri2)) + .thenAnswer((_) => Future.value(tExerciseInfoMap)); }); group('Correctly loads and parses data from the server', () { @@ -45,7 +73,7 @@ void main() { final base = await provider.fetchAndSetExercise(1); // assert - verifyNever(provider.baseProvider.fetch(tExerciseBaseInfoUri)); + verifyNever(provider.baseProvider.fetch(tExerciseBaseInfoUri2)); expect(base.id, 1); }); diff --git a/test/exercises/exercise_provider_test.dart b/test/exercises/exercise_provider_test.dart index 312fcb53..bb6ba072 100644 --- a/test/exercises/exercise_provider_test.dart +++ b/test/exercises/exercise_provider_test.dart @@ -1,8 +1,11 @@ import 'dart:convert'; +import 'package:drift/drift.dart'; +import 'package:drift/native.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:wger/database/exercises/exercise_database.dart'; import 'package:wger/exceptions/no_such_entry_exception.dart'; import 'package:wger/helpers/consts.dart'; import 'package:wger/models/exercises/category.dart'; @@ -32,10 +35,10 @@ void main() { path: 'api/v2/$categoryUrl/', ); - final Uri texerciseBaseInfoUri = Uri( + final Uri tExerciseInfoUri = Uri( scheme: 'http', host: 'localhost', - path: 'api/v2/$exerciseBaseInfoUrl/', + path: 'api/v2/$exerciseBaseInfoUrl/1/', ); final Uri tMuscleEntriesUri = Uri( @@ -81,10 +84,21 @@ void main() { fixture('exercises/exercisebaseinfo_response.json'), ); + setUpAll(() async { + // Needs to be configured here, setUp runs on every test, setUpAll only once + //await ServiceLocator().configure(); + }); + setUp(() { mockBaseProvider = MockWgerBaseProvider(); - provider = ExercisesProvider(mockBaseProvider); + provider = ExercisesProvider( + mockBaseProvider, + database: ExerciseDatabase.inMemory(NativeDatabase.memory()), + ); + provider.languages = [...testLanguages]; + SharedPreferences.setMockInitialValues({}); + driftRuntimeOptions.dontWarnAboutMultipleDatabases = true; // Mock categories when(mockBaseProvider.makeUrl(categoryUrl)).thenReturn(tCategoryEntriesUri); @@ -108,8 +122,9 @@ void main() { .thenAnswer((_) => Future.value(tLanguageMap['results'])); // Mock base info response - when(mockBaseProvider.makeUrl(exerciseBaseInfoUrl)).thenReturn(texerciseBaseInfoUri); - when(mockBaseProvider.fetch(texerciseBaseInfoUri)) + when(mockBaseProvider.makeUrl(exerciseBaseInfoUrl, id: 1)).thenReturn(tExerciseInfoUri); + when(mockBaseProvider.makeUrl(exerciseBaseInfoUrl, id: 2)).thenReturn(tExerciseInfoUri); + when(mockBaseProvider.fetch(tExerciseInfoUri)) .thenAnswer((_) => Future.value(tExerciseBaseInfoMap)); }); diff --git a/test/workout/gym_mode_screen_test.mocks.dart b/test/workout/gym_mode_screen_test.mocks.dart index 052af48e..1ddf87bf 100644 --- a/test/workout/gym_mode_screen_test.mocks.dart +++ b/test/workout/gym_mode_screen_test.mocks.dart @@ -3,20 +3,20 @@ // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i10; +import 'dart:async' as _i11; import 'dart:ui' as _i13; import 'package:http/http.dart' as _i3; import 'package:mockito/mockito.dart' as _i1; -import 'package:wger/database/exercises/exercise_database.dart' as _i12; -import 'package:wger/models/exercises/category.dart' as _i6; -import 'package:wger/models/exercises/equipment.dart' as _i7; -import 'package:wger/models/exercises/exercise.dart' as _i5; -import 'package:wger/models/exercises/language.dart' as _i9; -import 'package:wger/models/exercises/muscle.dart' as _i8; +import 'package:wger/database/exercises/exercise_database.dart' as _i5; +import 'package:wger/models/exercises/category.dart' as _i7; +import 'package:wger/models/exercises/equipment.dart' as _i8; +import 'package:wger/models/exercises/exercise.dart' as _i6; +import 'package:wger/models/exercises/language.dart' as _i10; +import 'package:wger/models/exercises/muscle.dart' as _i9; import 'package:wger/providers/auth.dart' as _i2; import 'package:wger/providers/base_provider.dart' as _i4; -import 'package:wger/providers/exercises.dart' as _i11; +import 'package:wger/providers/exercises.dart' as _i12; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -81,8 +81,8 @@ class _FakeWgerBaseProvider_4 extends _i1.SmartFake implements _i4.WgerBaseProvi ); } -class _FakeExercise_5 extends _i1.SmartFake implements _i5.Exercise { - _FakeExercise_5( +class _FakeExerciseDatabase_5 extends _i1.SmartFake implements _i5.ExerciseDatabase { + _FakeExerciseDatabase_5( Object parent, Invocation parentInvocation, ) : super( @@ -91,8 +91,8 @@ class _FakeExercise_5 extends _i1.SmartFake implements _i5.Exercise { ); } -class _FakeExerciseCategory_6 extends _i1.SmartFake implements _i6.ExerciseCategory { - _FakeExerciseCategory_6( +class _FakeExercise_6 extends _i1.SmartFake implements _i6.Exercise { + _FakeExercise_6( Object parent, Invocation parentInvocation, ) : super( @@ -101,8 +101,8 @@ class _FakeExerciseCategory_6 extends _i1.SmartFake implements _i6.ExerciseCateg ); } -class _FakeEquipment_7 extends _i1.SmartFake implements _i7.Equipment { - _FakeEquipment_7( +class _FakeExerciseCategory_7 extends _i1.SmartFake implements _i7.ExerciseCategory { + _FakeExerciseCategory_7( Object parent, Invocation parentInvocation, ) : super( @@ -111,8 +111,8 @@ class _FakeEquipment_7 extends _i1.SmartFake implements _i7.Equipment { ); } -class _FakeMuscle_8 extends _i1.SmartFake implements _i8.Muscle { - _FakeMuscle_8( +class _FakeEquipment_8 extends _i1.SmartFake implements _i8.Equipment { + _FakeEquipment_8( Object parent, Invocation parentInvocation, ) : super( @@ -121,8 +121,18 @@ class _FakeMuscle_8 extends _i1.SmartFake implements _i8.Muscle { ); } -class _FakeLanguage_9 extends _i1.SmartFake implements _i9.Language { - _FakeLanguage_9( +class _FakeMuscle_9 extends _i1.SmartFake implements _i9.Muscle { + _FakeMuscle_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeLanguage_10 extends _i1.SmartFake implements _i10.Language { + _FakeLanguage_10( Object parent, Invocation parentInvocation, ) : super( @@ -217,25 +227,25 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ) as Uri); @override - _i10.Future> fetch(Uri? uri) => (super.noSuchMethod( + _i11.Future> fetch(Uri? uri) => (super.noSuchMethod( Invocation.method( #fetch, [uri], ), - returnValue: _i10.Future>.value({}), - ) as _i10.Future>); + returnValue: _i11.Future>.value({}), + ) as _i11.Future>); @override - _i10.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( + _i11.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( Invocation.method( #fetchPaginated, [uri], ), - returnValue: _i10.Future>.value([]), - ) as _i10.Future>); + returnValue: _i11.Future>.value([]), + ) as _i11.Future>); @override - _i10.Future> post( + _i11.Future> post( Map? data, Uri? uri, ) => @@ -247,11 +257,11 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i10.Future>.value({}), - ) as _i10.Future>); + returnValue: _i11.Future>.value({}), + ) as _i11.Future>); @override - _i10.Future> patch( + _i11.Future> patch( Map? data, Uri? uri, ) => @@ -263,11 +273,11 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { uri, ], ), - returnValue: _i10.Future>.value({}), - ) as _i10.Future>); + returnValue: _i11.Future>.value({}), + ) as _i11.Future>); @override - _i10.Future<_i3.Response> deleteRequest( + _i11.Future<_i3.Response> deleteRequest( String? url, int? id, ) => @@ -279,7 +289,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { id, ], ), - returnValue: _i10.Future<_i3.Response>.value(_FakeResponse_3( + returnValue: _i11.Future<_i3.Response>.value(_FakeResponse_3( this, Invocation.method( #deleteRequest, @@ -289,13 +299,13 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { ], ), )), - ) as _i10.Future<_i3.Response>); + ) as _i11.Future<_i3.Response>); } /// A class which mocks [ExercisesProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { +class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider { MockExercisesProvider() { _i1.throwOnMissingStub(this); } @@ -310,13 +320,31 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ) as _i4.WgerBaseProvider); @override - List<_i5.Exercise> get exercises => (super.noSuchMethod( - Invocation.getter(#exercises), - returnValue: <_i5.Exercise>[], - ) as List<_i5.Exercise>); + _i5.ExerciseDatabase get database => (super.noSuchMethod( + Invocation.getter(#database), + returnValue: _FakeExerciseDatabase_5( + this, + Invocation.getter(#database), + ), + ) as _i5.ExerciseDatabase); @override - set exercises(List<_i5.Exercise>? _exercises) => super.noSuchMethod( + set database(_i5.ExerciseDatabase? _database) => super.noSuchMethod( + Invocation.setter( + #database, + _database, + ), + returnValueForMissingStub: null, + ); + + @override + List<_i6.Exercise> get exercises => (super.noSuchMethod( + Invocation.getter(#exercises), + returnValue: <_i6.Exercise>[], + ) as List<_i6.Exercise>); + + @override + set exercises(List<_i6.Exercise>? _exercises) => super.noSuchMethod( Invocation.setter( #exercises, _exercises, @@ -325,13 +353,13 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ); @override - List<_i5.Exercise> get filteredExercises => (super.noSuchMethod( + List<_i6.Exercise> get filteredExercises => (super.noSuchMethod( Invocation.getter(#filteredExercises), - returnValue: <_i5.Exercise>[], - ) as List<_i5.Exercise>); + returnValue: <_i6.Exercise>[], + ) as List<_i6.Exercise>); @override - set filteredExercises(List<_i5.Exercise>? newFilteredExercises) => super.noSuchMethod( + set filteredExercises(List<_i6.Exercise>? newFilteredExercises) => super.noSuchMethod( Invocation.setter( #filteredExercises, newFilteredExercises, @@ -340,37 +368,37 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ); @override - Map> get exerciseBasesByVariation => (super.noSuchMethod( + Map> get exerciseBasesByVariation => (super.noSuchMethod( Invocation.getter(#exerciseBasesByVariation), - returnValue: >{}, - ) as Map>); + returnValue: >{}, + ) as Map>); @override - List<_i6.ExerciseCategory> get categories => (super.noSuchMethod( + List<_i7.ExerciseCategory> get categories => (super.noSuchMethod( Invocation.getter(#categories), - returnValue: <_i6.ExerciseCategory>[], - ) as List<_i6.ExerciseCategory>); + returnValue: <_i7.ExerciseCategory>[], + ) as List<_i7.ExerciseCategory>); @override - List<_i8.Muscle> get muscles => (super.noSuchMethod( + List<_i9.Muscle> get muscles => (super.noSuchMethod( Invocation.getter(#muscles), - returnValue: <_i8.Muscle>[], - ) as List<_i8.Muscle>); + returnValue: <_i9.Muscle>[], + ) as List<_i9.Muscle>); @override - List<_i7.Equipment> get equipment => (super.noSuchMethod( + List<_i8.Equipment> get equipment => (super.noSuchMethod( Invocation.getter(#equipment), - returnValue: <_i7.Equipment>[], - ) as List<_i7.Equipment>); + returnValue: <_i8.Equipment>[], + ) as List<_i8.Equipment>); @override - List<_i9.Language> get languages => (super.noSuchMethod( + List<_i10.Language> get languages => (super.noSuchMethod( Invocation.getter(#languages), - returnValue: <_i9.Language>[], - ) as List<_i9.Language>); + returnValue: <_i10.Language>[], + ) as List<_i10.Language>); @override - set languages(List<_i9.Language>? languages) => super.noSuchMethod( + set languages(List<_i10.Language>? languages) => super.noSuchMethod( Invocation.setter( #languages, languages, @@ -385,24 +413,24 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ) as bool); @override - _i10.Future setFilters(_i11.Filters? newFilters) => (super.noSuchMethod( + _i11.Future setFilters(_i12.Filters? newFilters) => (super.noSuchMethod( Invocation.method( #setFilters, [newFilters], ), - returnValue: _i10.Future.value(), - returnValueForMissingStub: _i10.Future.value(), - ) as _i10.Future); + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); @override - _i10.Future findByFilters() => (super.noSuchMethod( + _i11.Future findByFilters() => (super.noSuchMethod( Invocation.method( #findByFilters, [], ), - returnValue: _i10.Future.value(), - returnValueForMissingStub: _i10.Future.value(), - ) as _i10.Future); + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); @override void clear() => super.noSuchMethod( @@ -414,162 +442,152 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ); @override - _i5.Exercise findExerciseById(int? id) => (super.noSuchMethod( + _i6.Exercise findExerciseById(int? id) => (super.noSuchMethod( Invocation.method( #findExerciseById, [id], ), - returnValue: _FakeExercise_5( + returnValue: _FakeExercise_6( this, Invocation.method( #findExerciseById, [id], ), ), - ) as _i5.Exercise); + ) as _i6.Exercise); @override - List<_i5.Exercise> findExercisesByVariationId( + List<_i6.Exercise> findExercisesByVariationId( int? id, { int? exerciseBaseIdToExclude, }) => (super.noSuchMethod( Invocation.method( - #findExerciseBasesByVariationId, + #findExercisesByVariationId, [id], {#exerciseBaseIdToExclude: exerciseBaseIdToExclude}, ), - returnValue: <_i5.Exercise>[], - ) as List<_i5.Exercise>); + returnValue: <_i6.Exercise>[], + ) as List<_i6.Exercise>); @override - _i6.ExerciseCategory findCategoryById(int? id) => (super.noSuchMethod( + _i7.ExerciseCategory findCategoryById(int? id) => (super.noSuchMethod( Invocation.method( #findCategoryById, [id], ), - returnValue: _FakeExerciseCategory_6( + returnValue: _FakeExerciseCategory_7( this, Invocation.method( #findCategoryById, [id], ), ), - ) as _i6.ExerciseCategory); + ) as _i7.ExerciseCategory); @override - _i7.Equipment findEquipmentById(int? id) => (super.noSuchMethod( + _i8.Equipment findEquipmentById(int? id) => (super.noSuchMethod( Invocation.method( #findEquipmentById, [id], ), - returnValue: _FakeEquipment_7( + returnValue: _FakeEquipment_8( this, Invocation.method( #findEquipmentById, [id], ), ), - ) as _i7.Equipment); + ) as _i8.Equipment); @override - _i8.Muscle findMuscleById(int? id) => (super.noSuchMethod( + _i9.Muscle findMuscleById(int? id) => (super.noSuchMethod( Invocation.method( #findMuscleById, [id], ), - returnValue: _FakeMuscle_8( + returnValue: _FakeMuscle_9( this, Invocation.method( #findMuscleById, [id], ), ), - ) as _i8.Muscle); + ) as _i9.Muscle); @override - _i9.Language findLanguageById(int? id) => (super.noSuchMethod( + _i10.Language findLanguageById(int? id) => (super.noSuchMethod( Invocation.method( #findLanguageById, [id], ), - returnValue: _FakeLanguage_9( + returnValue: _FakeLanguage_10( this, Invocation.method( #findLanguageById, [id], ), ), - ) as _i9.Language); + ) as _i10.Language); @override - _i10.Future fetchAndSetCategoriesFromApi() => (super.noSuchMethod( + _i11.Future fetchAndSetCategoriesFromApi() => (super.noSuchMethod( Invocation.method( #fetchAndSetCategoriesFromApi, [], ), - returnValue: _i10.Future.value(), - returnValueForMissingStub: _i10.Future.value(), - ) as _i10.Future); + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); @override - _i10.Future fetchAndSetVariationsFromApi() => (super.noSuchMethod( - Invocation.method( - #fetchAndSetVariationsFromApi, - [], - ), - returnValue: _i10.Future.value(), - returnValueForMissingStub: _i10.Future.value(), - ) as _i10.Future); - - @override - _i10.Future fetchAndSetMusclesFromApi() => (super.noSuchMethod( + _i11.Future fetchAndSetMusclesFromApi() => (super.noSuchMethod( Invocation.method( #fetchAndSetMusclesFromApi, [], ), - returnValue: _i10.Future.value(), - returnValueForMissingStub: _i10.Future.value(), - ) as _i10.Future); + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); @override - _i10.Future fetchAndSetEquipmentsFromApi() => (super.noSuchMethod( + _i11.Future fetchAndSetEquipmentsFromApi() => (super.noSuchMethod( Invocation.method( #fetchAndSetEquipmentsFromApi, [], ), - returnValue: _i10.Future.value(), - returnValueForMissingStub: _i10.Future.value(), - ) as _i10.Future); + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); @override - _i10.Future fetchAndSetLanguagesFromApi() => (super.noSuchMethod( + _i11.Future fetchAndSetLanguagesFromApi() => (super.noSuchMethod( Invocation.method( #fetchAndSetLanguagesFromApi, [], ), - returnValue: _i10.Future.value(), - returnValueForMissingStub: _i10.Future.value(), - ) as _i10.Future); + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); @override - _i10.Future<_i5.Exercise> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod( + _i11.Future<_i6.Exercise> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod( Invocation.method( #fetchAndSetExercise, [exerciseId], ), - returnValue: _i10.Future<_i5.Exercise>.value(_FakeExercise_5( + returnValue: _i11.Future<_i6.Exercise>.value(_FakeExercise_6( this, Invocation.method( #fetchAndSetExercise, [exerciseId], ), )), - ) as _i10.Future<_i5.Exercise>); + ) as _i11.Future<_i6.Exercise>); @override - _i10.Future<_i5.Exercise> handleUpdateExerciseFromApi( - _i12.ExerciseDatabase? database, + _i11.Future<_i6.Exercise> handleUpdateExerciseFromApi( + _i5.ExerciseDatabase? database, int? exerciseId, ) => (super.noSuchMethod( @@ -580,7 +598,7 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { exerciseId, ], ), - returnValue: _i10.Future<_i5.Exercise>.value(_FakeExercise_5( + returnValue: _i11.Future<_i6.Exercise>.value(_FakeExercise_6( this, Invocation.method( #handleUpdateExerciseFromApi, @@ -590,52 +608,52 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { ], ), )), - ) as _i10.Future<_i5.Exercise>); + ) as _i11.Future<_i6.Exercise>); @override - _i10.Future checkExerciseCacheVersion() => (super.noSuchMethod( + _i11.Future checkExerciseCacheVersion() => (super.noSuchMethod( Invocation.method( #checkExerciseCacheVersion, [], ), - returnValue: _i10.Future.value(), - returnValueForMissingStub: _i10.Future.value(), - ) as _i10.Future); + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); @override - _i10.Future initCacheTimesLocalPrefs({dynamic forceInit = false}) => (super.noSuchMethod( + _i11.Future initCacheTimesLocalPrefs({dynamic forceInit = false}) => (super.noSuchMethod( Invocation.method( #initCacheTimesLocalPrefs, [], {#forceInit: forceInit}, ), - returnValue: _i10.Future.value(), - returnValueForMissingStub: _i10.Future.value(), - ) as _i10.Future); + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); @override - _i10.Future clearAllCachesAndPrefs() => (super.noSuchMethod( + _i11.Future clearAllCachesAndPrefs() => (super.noSuchMethod( Invocation.method( #clearAllCachesAndPrefs, [], ), - returnValue: _i10.Future.value(), - returnValueForMissingStub: _i10.Future.value(), - ) as _i10.Future); + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); @override - _i10.Future fetchAndSetInitialData() => (super.noSuchMethod( + _i11.Future fetchAndSetInitialData() => (super.noSuchMethod( Invocation.method( #fetchAndSetInitialData, [], ), - returnValue: _i10.Future.value(), - returnValueForMissingStub: _i10.Future.value(), - ) as _i10.Future); + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); @override - _i10.Future setExercisesFromDatabase( - _i12.ExerciseDatabase? database, { + _i11.Future setExercisesFromDatabase( + _i5.ExerciseDatabase? database, { bool? forceDeleteCache = false, }) => (super.noSuchMethod( @@ -644,62 +662,62 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { [database], {#forceDeleteCache: forceDeleteCache}, ), - returnValue: _i10.Future.value(), - returnValueForMissingStub: _i10.Future.value(), - ) as _i10.Future); + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); @override - _i10.Future updateExerciseCache(_i12.ExerciseDatabase? database) => (super.noSuchMethod( + _i11.Future updateExerciseCache(_i5.ExerciseDatabase? database) => (super.noSuchMethod( Invocation.method( #updateExerciseCache, [database], ), - returnValue: _i10.Future.value(), - returnValueForMissingStub: _i10.Future.value(), - ) as _i10.Future); + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); @override - _i10.Future fetchAndSetMuscles(_i12.ExerciseDatabase? database) => (super.noSuchMethod( + _i11.Future fetchAndSetMuscles(_i5.ExerciseDatabase? database) => (super.noSuchMethod( Invocation.method( #fetchAndSetMuscles, [database], ), - returnValue: _i10.Future.value(), - returnValueForMissingStub: _i10.Future.value(), - ) as _i10.Future); + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); @override - _i10.Future fetchAndSetCategories(_i12.ExerciseDatabase? database) => (super.noSuchMethod( + _i11.Future fetchAndSetCategories(_i5.ExerciseDatabase? database) => (super.noSuchMethod( Invocation.method( #fetchAndSetCategories, [database], ), - returnValue: _i10.Future.value(), - returnValueForMissingStub: _i10.Future.value(), - ) as _i10.Future); + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); @override - _i10.Future fetchAndSetLanguages(_i12.ExerciseDatabase? database) => (super.noSuchMethod( + _i11.Future fetchAndSetLanguages(_i5.ExerciseDatabase? database) => (super.noSuchMethod( Invocation.method( #fetchAndSetLanguages, [database], ), - returnValue: _i10.Future.value(), - returnValueForMissingStub: _i10.Future.value(), - ) as _i10.Future); + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); @override - _i10.Future fetchAndSetEquipments(_i12.ExerciseDatabase? database) => (super.noSuchMethod( + _i11.Future fetchAndSetEquipments(_i5.ExerciseDatabase? database) => (super.noSuchMethod( Invocation.method( #fetchAndSetEquipments, [database], ), - returnValue: _i10.Future.value(), - returnValueForMissingStub: _i10.Future.value(), - ) as _i10.Future); + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); @override - _i10.Future> searchExercise( + _i11.Future> searchExercise( String? name, { String? languageCode = r'en', bool? searchEnglish = false, @@ -713,8 +731,8 @@ class MockExercisesProvider extends _i1.Mock implements _i11.ExercisesProvider { #searchEnglish: searchEnglish, }, ), - returnValue: _i10.Future>.value(<_i5.Exercise>[]), - ) as _i10.Future>); + returnValue: _i11.Future>.value(<_i6.Exercise>[]), + ) as _i11.Future>); @override void addListener(_i13.VoidCallback? listener) => super.noSuchMethod( diff --git a/test/workout/workout_plan_screen_test.dart b/test/workout/workout_plan_screen_test.dart index 838e7d41..5503dae0 100644 --- a/test/workout/workout_plan_screen_test.dart +++ b/test/workout/workout_plan_screen_test.dart @@ -16,11 +16,13 @@ * along with this program. If not, see . */ +import 'package:drift/native.dart'; 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:provider/provider.dart'; +import 'package:wger/database/exercises/exercise_database.dart'; import 'package:wger/providers/base_provider.dart'; import 'package:wger/providers/exercises.dart'; import 'package:wger/providers/workout_plans.dart'; @@ -32,7 +34,10 @@ import 'workout_plan_screen_test.mocks.dart'; @GenerateMocks([WgerBaseProvider]) void main() { final mockBaseProvider = MockWgerBaseProvider(); - final exercisesProvider = ExercisesProvider(mockBaseProvider); + final exercisesProvider = ExercisesProvider( + mockBaseProvider, + database: ExerciseDatabase.inMemory(NativeDatabase.memory()), + ); Widget createHomeScreen({locale = 'en'}) { final key = GlobalKey(); diff --git a/test/workout/workout_plans_screen_test.dart b/test/workout/workout_plans_screen_test.dart index 45ee4879..dd3e880d 100644 --- a/test/workout/workout_plans_screen_test.dart +++ b/test/workout/workout_plans_screen_test.dart @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +import 'package:drift/native.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -23,6 +24,7 @@ import 'package:http/http.dart' as http; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; +import 'package:wger/database/exercises/exercise_database.dart'; import 'package:wger/models/workouts/workout_plan.dart'; import 'package:wger/providers/base_provider.dart'; import 'package:wger/providers/exercises.dart'; @@ -37,7 +39,10 @@ import 'workout_plans_screen_test.mocks.dart'; @GenerateMocks([WgerBaseProvider]) void main() { var mockBaseProvider = MockWgerBaseProvider(); - final testExercisesProvider = ExercisesProvider(mockBaseProvider); + final testExercisesProvider = ExercisesProvider( + mockBaseProvider, + database: ExerciseDatabase.inMemory(NativeDatabase.memory()), + ); setUp(() { mockBaseProvider = MockWgerBaseProvider(); diff --git a/test/workout/workout_provider_test.dart b/test/workout/workout_provider_test.dart index 3c242e82..2c62009d 100644 --- a/test/workout/workout_provider_test.dart +++ b/test/workout/workout_provider_test.dart @@ -24,6 +24,7 @@ import 'package:http/http.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:wger/core/locator.dart'; import 'package:wger/models/workouts/repetition_unit.dart'; import 'package:wger/models/workouts/weight_unit.dart'; import 'package:wger/models/workouts/workout_plan.dart'; @@ -38,6 +39,11 @@ import 'workout_provider_test.mocks.dart'; void main() { final mockBaseProvider = MockWgerBaseProvider(); + setUpAll(() async { + // Needs to be configured here, setUp runs on every test, setUpAll only once + await ServiceLocator().configure(); + }); + group('test the workout routine provider', () { test('Test fetching and setting a plan', () async { final exercisesProvider = ExercisesProvider(mockBaseProvider); diff --git a/test/workout/workout_set_form_test.mocks.dart b/test/workout/workout_set_form_test.mocks.dart index af312910..9b5099d7 100644 --- a/test/workout/workout_set_form_test.mocks.dart +++ b/test/workout/workout_set_form_test.mocks.dart @@ -3,30 +3,30 @@ // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i19; +import 'dart:async' as _i20; import 'dart:ui' as _i21; -import 'package:http/http.dart' as _i9; +import 'package:http/http.dart' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:mockito/src/dummies.dart' as _i24; -import 'package:wger/database/exercises/exercise_database.dart' as _i20; -import 'package:wger/models/exercises/category.dart' as _i4; -import 'package:wger/models/exercises/equipment.dart' as _i5; -import 'package:wger/models/exercises/exercise.dart' as _i3; -import 'package:wger/models/exercises/language.dart' as _i7; -import 'package:wger/models/exercises/muscle.dart' as _i6; +import 'package:wger/database/exercises/exercise_database.dart' as _i3; +import 'package:wger/models/exercises/category.dart' as _i5; +import 'package:wger/models/exercises/equipment.dart' as _i6; +import 'package:wger/models/exercises/exercise.dart' as _i4; +import 'package:wger/models/exercises/language.dart' as _i8; +import 'package:wger/models/exercises/muscle.dart' as _i7; import 'package:wger/models/exercises/translation.dart' as _i23; -import 'package:wger/models/workouts/day.dart' as _i13; -import 'package:wger/models/workouts/log.dart' as _i17; -import 'package:wger/models/workouts/repetition_unit.dart' as _i11; -import 'package:wger/models/workouts/session.dart' as _i16; -import 'package:wger/models/workouts/set.dart' as _i14; -import 'package:wger/models/workouts/setting.dart' as _i15; -import 'package:wger/models/workouts/weight_unit.dart' as _i10; -import 'package:wger/models/workouts/workout_plan.dart' as _i12; -import 'package:wger/providers/auth.dart' as _i8; +import 'package:wger/models/workouts/day.dart' as _i14; +import 'package:wger/models/workouts/log.dart' as _i18; +import 'package:wger/models/workouts/repetition_unit.dart' as _i12; +import 'package:wger/models/workouts/session.dart' as _i17; +import 'package:wger/models/workouts/set.dart' as _i15; +import 'package:wger/models/workouts/setting.dart' as _i16; +import 'package:wger/models/workouts/weight_unit.dart' as _i11; +import 'package:wger/models/workouts/workout_plan.dart' as _i13; +import 'package:wger/providers/auth.dart' as _i9; import 'package:wger/providers/base_provider.dart' as _i2; -import 'package:wger/providers/exercises.dart' as _i18; +import 'package:wger/providers/exercises.dart' as _i19; import 'package:wger/providers/workout_plans.dart' as _i22; // ignore_for_file: type=lint @@ -52,8 +52,8 @@ class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvi ); } -class _FakeExercise_1 extends _i1.SmartFake implements _i3.Exercise { - _FakeExercise_1( +class _FakeExerciseDatabase_1 extends _i1.SmartFake implements _i3.ExerciseDatabase { + _FakeExerciseDatabase_1( Object parent, Invocation parentInvocation, ) : super( @@ -62,8 +62,8 @@ class _FakeExercise_1 extends _i1.SmartFake implements _i3.Exercise { ); } -class _FakeExerciseCategory_2 extends _i1.SmartFake implements _i4.ExerciseCategory { - _FakeExerciseCategory_2( +class _FakeExercise_2 extends _i1.SmartFake implements _i4.Exercise { + _FakeExercise_2( Object parent, Invocation parentInvocation, ) : super( @@ -72,8 +72,8 @@ class _FakeExerciseCategory_2 extends _i1.SmartFake implements _i4.ExerciseCateg ); } -class _FakeEquipment_3 extends _i1.SmartFake implements _i5.Equipment { - _FakeEquipment_3( +class _FakeExerciseCategory_3 extends _i1.SmartFake implements _i5.ExerciseCategory { + _FakeExerciseCategory_3( Object parent, Invocation parentInvocation, ) : super( @@ -82,8 +82,8 @@ class _FakeEquipment_3 extends _i1.SmartFake implements _i5.Equipment { ); } -class _FakeMuscle_4 extends _i1.SmartFake implements _i6.Muscle { - _FakeMuscle_4( +class _FakeEquipment_4 extends _i1.SmartFake implements _i6.Equipment { + _FakeEquipment_4( Object parent, Invocation parentInvocation, ) : super( @@ -92,8 +92,8 @@ class _FakeMuscle_4 extends _i1.SmartFake implements _i6.Muscle { ); } -class _FakeLanguage_5 extends _i1.SmartFake implements _i7.Language { - _FakeLanguage_5( +class _FakeMuscle_5 extends _i1.SmartFake implements _i7.Muscle { + _FakeMuscle_5( Object parent, Invocation parentInvocation, ) : super( @@ -102,8 +102,8 @@ class _FakeLanguage_5 extends _i1.SmartFake implements _i7.Language { ); } -class _FakeAuthProvider_6 extends _i1.SmartFake implements _i8.AuthProvider { - _FakeAuthProvider_6( +class _FakeLanguage_6 extends _i1.SmartFake implements _i8.Language { + _FakeLanguage_6( Object parent, Invocation parentInvocation, ) : super( @@ -112,8 +112,8 @@ class _FakeAuthProvider_6 extends _i1.SmartFake implements _i8.AuthProvider { ); } -class _FakeClient_7 extends _i1.SmartFake implements _i9.Client { - _FakeClient_7( +class _FakeAuthProvider_7 extends _i1.SmartFake implements _i9.AuthProvider { + _FakeAuthProvider_7( Object parent, Invocation parentInvocation, ) : super( @@ -122,8 +122,8 @@ class _FakeClient_7 extends _i1.SmartFake implements _i9.Client { ); } -class _FakeUri_8 extends _i1.SmartFake implements Uri { - _FakeUri_8( +class _FakeClient_8 extends _i1.SmartFake implements _i10.Client { + _FakeClient_8( Object parent, Invocation parentInvocation, ) : super( @@ -132,8 +132,8 @@ class _FakeUri_8 extends _i1.SmartFake implements Uri { ); } -class _FakeResponse_9 extends _i1.SmartFake implements _i9.Response { - _FakeResponse_9( +class _FakeUri_9 extends _i1.SmartFake implements Uri { + _FakeUri_9( Object parent, Invocation parentInvocation, ) : super( @@ -142,8 +142,8 @@ class _FakeResponse_9 extends _i1.SmartFake implements _i9.Response { ); } -class _FakeWeightUnit_10 extends _i1.SmartFake implements _i10.WeightUnit { - _FakeWeightUnit_10( +class _FakeResponse_10 extends _i1.SmartFake implements _i10.Response { + _FakeResponse_10( Object parent, Invocation parentInvocation, ) : super( @@ -152,8 +152,8 @@ class _FakeWeightUnit_10 extends _i1.SmartFake implements _i10.WeightUnit { ); } -class _FakeRepetitionUnit_11 extends _i1.SmartFake implements _i11.RepetitionUnit { - _FakeRepetitionUnit_11( +class _FakeWeightUnit_11 extends _i1.SmartFake implements _i11.WeightUnit { + _FakeWeightUnit_11( Object parent, Invocation parentInvocation, ) : super( @@ -162,8 +162,8 @@ class _FakeRepetitionUnit_11 extends _i1.SmartFake implements _i11.RepetitionUni ); } -class _FakeWorkoutPlan_12 extends _i1.SmartFake implements _i12.WorkoutPlan { - _FakeWorkoutPlan_12( +class _FakeRepetitionUnit_12 extends _i1.SmartFake implements _i12.RepetitionUnit { + _FakeRepetitionUnit_12( Object parent, Invocation parentInvocation, ) : super( @@ -172,8 +172,8 @@ class _FakeWorkoutPlan_12 extends _i1.SmartFake implements _i12.WorkoutPlan { ); } -class _FakeDay_13 extends _i1.SmartFake implements _i13.Day { - _FakeDay_13( +class _FakeWorkoutPlan_13 extends _i1.SmartFake implements _i13.WorkoutPlan { + _FakeWorkoutPlan_13( Object parent, Invocation parentInvocation, ) : super( @@ -182,8 +182,8 @@ class _FakeDay_13 extends _i1.SmartFake implements _i13.Day { ); } -class _FakeSet_14 extends _i1.SmartFake implements _i14.Set { - _FakeSet_14( +class _FakeDay_14 extends _i1.SmartFake implements _i14.Day { + _FakeDay_14( Object parent, Invocation parentInvocation, ) : super( @@ -192,8 +192,8 @@ class _FakeSet_14 extends _i1.SmartFake implements _i14.Set { ); } -class _FakeSetting_15 extends _i1.SmartFake implements _i15.Setting { - _FakeSetting_15( +class _FakeSet_15 extends _i1.SmartFake implements _i15.Set { + _FakeSet_15( Object parent, Invocation parentInvocation, ) : super( @@ -202,8 +202,8 @@ class _FakeSetting_15 extends _i1.SmartFake implements _i15.Setting { ); } -class _FakeWorkoutSession_16 extends _i1.SmartFake implements _i16.WorkoutSession { - _FakeWorkoutSession_16( +class _FakeSetting_16 extends _i1.SmartFake implements _i16.Setting { + _FakeSetting_16( Object parent, Invocation parentInvocation, ) : super( @@ -212,8 +212,18 @@ class _FakeWorkoutSession_16 extends _i1.SmartFake implements _i16.WorkoutSessio ); } -class _FakeLog_17 extends _i1.SmartFake implements _i17.Log { - _FakeLog_17( +class _FakeWorkoutSession_17 extends _i1.SmartFake implements _i17.WorkoutSession { + _FakeWorkoutSession_17( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeLog_18 extends _i1.SmartFake implements _i18.Log { + _FakeLog_18( Object parent, Invocation parentInvocation, ) : super( @@ -225,7 +235,7 @@ class _FakeLog_17 extends _i1.SmartFake implements _i17.Log { /// A class which mocks [ExercisesProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { +class MockExercisesProvider extends _i1.Mock implements _i19.ExercisesProvider { MockExercisesProvider() { _i1.throwOnMissingStub(this); } @@ -240,13 +250,31 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ) as _i2.WgerBaseProvider); @override - List<_i3.Exercise> get exercises => (super.noSuchMethod( - Invocation.getter(#exercises), - returnValue: <_i3.Exercise>[], - ) as List<_i3.Exercise>); + _i3.ExerciseDatabase get database => (super.noSuchMethod( + Invocation.getter(#database), + returnValue: _FakeExerciseDatabase_1( + this, + Invocation.getter(#database), + ), + ) as _i3.ExerciseDatabase); @override - set exercises(List<_i3.Exercise>? _exercises) => super.noSuchMethod( + set database(_i3.ExerciseDatabase? _database) => super.noSuchMethod( + Invocation.setter( + #database, + _database, + ), + returnValueForMissingStub: null, + ); + + @override + List<_i4.Exercise> get exercises => (super.noSuchMethod( + Invocation.getter(#exercises), + returnValue: <_i4.Exercise>[], + ) as List<_i4.Exercise>); + + @override + set exercises(List<_i4.Exercise>? _exercises) => super.noSuchMethod( Invocation.setter( #exercises, _exercises, @@ -255,13 +283,13 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ); @override - List<_i3.Exercise> get filteredExercises => (super.noSuchMethod( + List<_i4.Exercise> get filteredExercises => (super.noSuchMethod( Invocation.getter(#filteredExercises), - returnValue: <_i3.Exercise>[], - ) as List<_i3.Exercise>); + returnValue: <_i4.Exercise>[], + ) as List<_i4.Exercise>); @override - set filteredExercises(List<_i3.Exercise>? newFilteredExercises) => super.noSuchMethod( + set filteredExercises(List<_i4.Exercise>? newFilteredExercises) => super.noSuchMethod( Invocation.setter( #filteredExercises, newFilteredExercises, @@ -270,37 +298,37 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ); @override - Map> get exerciseBasesByVariation => (super.noSuchMethod( + Map> get exerciseBasesByVariation => (super.noSuchMethod( Invocation.getter(#exerciseBasesByVariation), - returnValue: >{}, - ) as Map>); + returnValue: >{}, + ) as Map>); @override - List<_i4.ExerciseCategory> get categories => (super.noSuchMethod( + List<_i5.ExerciseCategory> get categories => (super.noSuchMethod( Invocation.getter(#categories), - returnValue: <_i4.ExerciseCategory>[], - ) as List<_i4.ExerciseCategory>); + returnValue: <_i5.ExerciseCategory>[], + ) as List<_i5.ExerciseCategory>); @override - List<_i6.Muscle> get muscles => (super.noSuchMethod( + List<_i7.Muscle> get muscles => (super.noSuchMethod( Invocation.getter(#muscles), - returnValue: <_i6.Muscle>[], - ) as List<_i6.Muscle>); + returnValue: <_i7.Muscle>[], + ) as List<_i7.Muscle>); @override - List<_i5.Equipment> get equipment => (super.noSuchMethod( + List<_i6.Equipment> get equipment => (super.noSuchMethod( Invocation.getter(#equipment), - returnValue: <_i5.Equipment>[], - ) as List<_i5.Equipment>); + returnValue: <_i6.Equipment>[], + ) as List<_i6.Equipment>); @override - List<_i7.Language> get languages => (super.noSuchMethod( + List<_i8.Language> get languages => (super.noSuchMethod( Invocation.getter(#languages), - returnValue: <_i7.Language>[], - ) as List<_i7.Language>); + returnValue: <_i8.Language>[], + ) as List<_i8.Language>); @override - set languages(List<_i7.Language>? languages) => super.noSuchMethod( + set languages(List<_i8.Language>? languages) => super.noSuchMethod( Invocation.setter( #languages, languages, @@ -315,24 +343,24 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ) as bool); @override - _i19.Future setFilters(_i18.Filters? newFilters) => (super.noSuchMethod( + _i20.Future setFilters(_i19.Filters? newFilters) => (super.noSuchMethod( Invocation.method( #setFilters, [newFilters], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future findByFilters() => (super.noSuchMethod( + _i20.Future findByFilters() => (super.noSuchMethod( Invocation.method( #findByFilters, [], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override void clear() => super.noSuchMethod( @@ -344,162 +372,152 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ); @override - _i3.Exercise findExerciseById(int? id) => (super.noSuchMethod( + _i4.Exercise findExerciseById(int? id) => (super.noSuchMethod( Invocation.method( #findExerciseById, [id], ), - returnValue: _FakeExercise_1( + returnValue: _FakeExercise_2( this, Invocation.method( #findExerciseById, [id], ), ), - ) as _i3.Exercise); + ) as _i4.Exercise); @override - List<_i3.Exercise> findExercisesByVariationId( + List<_i4.Exercise> findExercisesByVariationId( int? id, { int? exerciseBaseIdToExclude, }) => (super.noSuchMethod( Invocation.method( - #findExerciseBasesByVariationId, + #findExercisesByVariationId, [id], {#exerciseBaseIdToExclude: exerciseBaseIdToExclude}, ), - returnValue: <_i3.Exercise>[], - ) as List<_i3.Exercise>); + returnValue: <_i4.Exercise>[], + ) as List<_i4.Exercise>); @override - _i4.ExerciseCategory findCategoryById(int? id) => (super.noSuchMethod( + _i5.ExerciseCategory findCategoryById(int? id) => (super.noSuchMethod( Invocation.method( #findCategoryById, [id], ), - returnValue: _FakeExerciseCategory_2( + returnValue: _FakeExerciseCategory_3( this, Invocation.method( #findCategoryById, [id], ), ), - ) as _i4.ExerciseCategory); + ) as _i5.ExerciseCategory); @override - _i5.Equipment findEquipmentById(int? id) => (super.noSuchMethod( + _i6.Equipment findEquipmentById(int? id) => (super.noSuchMethod( Invocation.method( #findEquipmentById, [id], ), - returnValue: _FakeEquipment_3( + returnValue: _FakeEquipment_4( this, Invocation.method( #findEquipmentById, [id], ), ), - ) as _i5.Equipment); + ) as _i6.Equipment); @override - _i6.Muscle findMuscleById(int? id) => (super.noSuchMethod( + _i7.Muscle findMuscleById(int? id) => (super.noSuchMethod( Invocation.method( #findMuscleById, [id], ), - returnValue: _FakeMuscle_4( + returnValue: _FakeMuscle_5( this, Invocation.method( #findMuscleById, [id], ), ), - ) as _i6.Muscle); + ) as _i7.Muscle); @override - _i7.Language findLanguageById(int? id) => (super.noSuchMethod( + _i8.Language findLanguageById(int? id) => (super.noSuchMethod( Invocation.method( #findLanguageById, [id], ), - returnValue: _FakeLanguage_5( + returnValue: _FakeLanguage_6( this, Invocation.method( #findLanguageById, [id], ), ), - ) as _i7.Language); + ) as _i8.Language); @override - _i19.Future fetchAndSetCategoriesFromApi() => (super.noSuchMethod( + _i20.Future fetchAndSetCategoriesFromApi() => (super.noSuchMethod( Invocation.method( #fetchAndSetCategoriesFromApi, [], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future fetchAndSetVariationsFromApi() => (super.noSuchMethod( - Invocation.method( - #fetchAndSetVariationsFromApi, - [], - ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); - - @override - _i19.Future fetchAndSetMusclesFromApi() => (super.noSuchMethod( + _i20.Future fetchAndSetMusclesFromApi() => (super.noSuchMethod( Invocation.method( #fetchAndSetMusclesFromApi, [], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future fetchAndSetEquipmentsFromApi() => (super.noSuchMethod( + _i20.Future fetchAndSetEquipmentsFromApi() => (super.noSuchMethod( Invocation.method( #fetchAndSetEquipmentsFromApi, [], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future fetchAndSetLanguagesFromApi() => (super.noSuchMethod( + _i20.Future fetchAndSetLanguagesFromApi() => (super.noSuchMethod( Invocation.method( #fetchAndSetLanguagesFromApi, [], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future<_i3.Exercise> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod( + _i20.Future<_i4.Exercise> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod( Invocation.method( #fetchAndSetExercise, [exerciseId], ), - returnValue: _i19.Future<_i3.Exercise>.value(_FakeExercise_1( + returnValue: _i20.Future<_i4.Exercise>.value(_FakeExercise_2( this, Invocation.method( #fetchAndSetExercise, [exerciseId], ), )), - ) as _i19.Future<_i3.Exercise>); + ) as _i20.Future<_i4.Exercise>); @override - _i19.Future<_i3.Exercise> handleUpdateExerciseFromApi( - _i20.ExerciseDatabase? database, + _i20.Future<_i4.Exercise> handleUpdateExerciseFromApi( + _i3.ExerciseDatabase? database, int? exerciseId, ) => (super.noSuchMethod( @@ -510,7 +528,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { exerciseId, ], ), - returnValue: _i19.Future<_i3.Exercise>.value(_FakeExercise_1( + returnValue: _i20.Future<_i4.Exercise>.value(_FakeExercise_2( this, Invocation.method( #handleUpdateExerciseFromApi, @@ -520,52 +538,52 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { ], ), )), - ) as _i19.Future<_i3.Exercise>); + ) as _i20.Future<_i4.Exercise>); @override - _i19.Future checkExerciseCacheVersion() => (super.noSuchMethod( + _i20.Future checkExerciseCacheVersion() => (super.noSuchMethod( Invocation.method( #checkExerciseCacheVersion, [], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future initCacheTimesLocalPrefs({dynamic forceInit = false}) => (super.noSuchMethod( + _i20.Future initCacheTimesLocalPrefs({dynamic forceInit = false}) => (super.noSuchMethod( Invocation.method( #initCacheTimesLocalPrefs, [], {#forceInit: forceInit}, ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future clearAllCachesAndPrefs() => (super.noSuchMethod( + _i20.Future clearAllCachesAndPrefs() => (super.noSuchMethod( Invocation.method( #clearAllCachesAndPrefs, [], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future fetchAndSetInitialData() => (super.noSuchMethod( + _i20.Future fetchAndSetInitialData() => (super.noSuchMethod( Invocation.method( #fetchAndSetInitialData, [], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future setExercisesFromDatabase( - _i20.ExerciseDatabase? database, { + _i20.Future setExercisesFromDatabase( + _i3.ExerciseDatabase? database, { bool? forceDeleteCache = false, }) => (super.noSuchMethod( @@ -574,62 +592,62 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { [database], {#forceDeleteCache: forceDeleteCache}, ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future updateExerciseCache(_i20.ExerciseDatabase? database) => (super.noSuchMethod( + _i20.Future updateExerciseCache(_i3.ExerciseDatabase? database) => (super.noSuchMethod( Invocation.method( #updateExerciseCache, [database], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future fetchAndSetMuscles(_i20.ExerciseDatabase? database) => (super.noSuchMethod( + _i20.Future fetchAndSetMuscles(_i3.ExerciseDatabase? database) => (super.noSuchMethod( Invocation.method( #fetchAndSetMuscles, [database], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future fetchAndSetCategories(_i20.ExerciseDatabase? database) => (super.noSuchMethod( + _i20.Future fetchAndSetCategories(_i3.ExerciseDatabase? database) => (super.noSuchMethod( Invocation.method( #fetchAndSetCategories, [database], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future fetchAndSetLanguages(_i20.ExerciseDatabase? database) => (super.noSuchMethod( + _i20.Future fetchAndSetLanguages(_i3.ExerciseDatabase? database) => (super.noSuchMethod( Invocation.method( #fetchAndSetLanguages, [database], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future fetchAndSetEquipments(_i20.ExerciseDatabase? database) => (super.noSuchMethod( + _i20.Future fetchAndSetEquipments(_i3.ExerciseDatabase? database) => (super.noSuchMethod( Invocation.method( #fetchAndSetEquipments, [database], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future> searchExercise( + _i20.Future> searchExercise( String? name, { String? languageCode = r'en', bool? searchEnglish = false, @@ -643,8 +661,8 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider { #searchEnglish: searchEnglish, }, ), - returnValue: _i19.Future>.value(<_i3.Exercise>[]), - ) as _i19.Future>); + returnValue: _i20.Future>.value(<_i4.Exercise>[]), + ) as _i20.Future>); @override void addListener(_i21.VoidCallback? listener) => super.noSuchMethod( @@ -692,16 +710,16 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { } @override - _i8.AuthProvider get auth => (super.noSuchMethod( + _i9.AuthProvider get auth => (super.noSuchMethod( Invocation.getter(#auth), - returnValue: _FakeAuthProvider_6( + returnValue: _FakeAuthProvider_7( this, Invocation.getter(#auth), ), - ) as _i8.AuthProvider); + ) as _i9.AuthProvider); @override - set auth(_i8.AuthProvider? _auth) => super.noSuchMethod( + set auth(_i9.AuthProvider? _auth) => super.noSuchMethod( Invocation.setter( #auth, _auth, @@ -710,16 +728,16 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { ); @override - _i9.Client get client => (super.noSuchMethod( + _i10.Client get client => (super.noSuchMethod( Invocation.getter(#client), - returnValue: _FakeClient_7( + returnValue: _FakeClient_8( this, Invocation.getter(#client), ), - ) as _i9.Client); + ) as _i10.Client); @override - set client(_i9.Client? _client) => super.noSuchMethod( + set client(_i10.Client? _client) => super.noSuchMethod( Invocation.setter( #client, _client, @@ -754,7 +772,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { #query: query, }, ), - returnValue: _FakeUri_8( + returnValue: _FakeUri_9( this, Invocation.method( #makeUrl, @@ -769,25 +787,25 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { ) as Uri); @override - _i19.Future> fetch(Uri? uri) => (super.noSuchMethod( + _i20.Future> fetch(Uri? uri) => (super.noSuchMethod( Invocation.method( #fetch, [uri], ), - returnValue: _i19.Future>.value({}), - ) as _i19.Future>); + returnValue: _i20.Future>.value({}), + ) as _i20.Future>); @override - _i19.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( + _i20.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( Invocation.method( #fetchPaginated, [uri], ), - returnValue: _i19.Future>.value([]), - ) as _i19.Future>); + returnValue: _i20.Future>.value([]), + ) as _i20.Future>); @override - _i19.Future> post( + _i20.Future> post( Map? data, Uri? uri, ) => @@ -799,11 +817,11 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { uri, ], ), - returnValue: _i19.Future>.value({}), - ) as _i19.Future>); + returnValue: _i20.Future>.value({}), + ) as _i20.Future>); @override - _i19.Future> patch( + _i20.Future> patch( Map? data, Uri? uri, ) => @@ -815,11 +833,11 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { uri, ], ), - returnValue: _i19.Future>.value({}), - ) as _i19.Future>); + returnValue: _i20.Future>.value({}), + ) as _i20.Future>); @override - _i19.Future<_i9.Response> deleteRequest( + _i20.Future<_i10.Response> deleteRequest( String? url, int? id, ) => @@ -831,7 +849,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { id, ], ), - returnValue: _i19.Future<_i9.Response>.value(_FakeResponse_9( + returnValue: _i20.Future<_i10.Response>.value(_FakeResponse_10( this, Invocation.method( #deleteRequest, @@ -841,7 +859,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { ], ), )), - ) as _i19.Future<_i9.Response>); + ) as _i20.Future<_i10.Response>); } /// A class which mocks [WorkoutPlansProvider]. @@ -862,40 +880,40 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i22.WorkoutPlansProv ) as _i2.WgerBaseProvider); @override - List<_i12.WorkoutPlan> get items => (super.noSuchMethod( + List<_i13.WorkoutPlan> get items => (super.noSuchMethod( Invocation.getter(#items), - returnValue: <_i12.WorkoutPlan>[], - ) as List<_i12.WorkoutPlan>); + returnValue: <_i13.WorkoutPlan>[], + ) as List<_i13.WorkoutPlan>); @override - List<_i10.WeightUnit> get weightUnits => (super.noSuchMethod( + List<_i11.WeightUnit> get weightUnits => (super.noSuchMethod( Invocation.getter(#weightUnits), - returnValue: <_i10.WeightUnit>[], - ) as List<_i10.WeightUnit>); + returnValue: <_i11.WeightUnit>[], + ) as List<_i11.WeightUnit>); @override - _i10.WeightUnit get defaultWeightUnit => (super.noSuchMethod( + _i11.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), - returnValue: _FakeWeightUnit_10( + returnValue: _FakeWeightUnit_11( this, Invocation.getter(#defaultWeightUnit), ), - ) as _i10.WeightUnit); + ) as _i11.WeightUnit); @override - List<_i11.RepetitionUnit> get repetitionUnits => (super.noSuchMethod( + List<_i12.RepetitionUnit> get repetitionUnits => (super.noSuchMethod( Invocation.getter(#repetitionUnits), - returnValue: <_i11.RepetitionUnit>[], - ) as List<_i11.RepetitionUnit>); + returnValue: <_i12.RepetitionUnit>[], + ) as List<_i12.RepetitionUnit>); @override - _i11.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( + _i12.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), - returnValue: _FakeRepetitionUnit_11( + returnValue: _FakeRepetitionUnit_12( this, Invocation.getter(#defaultRepetitionUnit), ), - ) as _i11.RepetitionUnit); + ) as _i12.RepetitionUnit); @override bool get hasListeners => (super.noSuchMethod( @@ -913,28 +931,28 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i22.WorkoutPlansProv ); @override - List<_i12.WorkoutPlan> getPlans() => (super.noSuchMethod( + List<_i13.WorkoutPlan> getPlans() => (super.noSuchMethod( Invocation.method( #getPlans, [], ), - returnValue: <_i12.WorkoutPlan>[], - ) as List<_i12.WorkoutPlan>); + returnValue: <_i13.WorkoutPlan>[], + ) as List<_i13.WorkoutPlan>); @override - _i12.WorkoutPlan findById(int? id) => (super.noSuchMethod( + _i13.WorkoutPlan findById(int? id) => (super.noSuchMethod( Invocation.method( #findById, [id], ), - returnValue: _FakeWorkoutPlan_12( + returnValue: _FakeWorkoutPlan_13( this, Invocation.method( #findById, [id], ), ), - ) as _i12.WorkoutPlan); + ) as _i13.WorkoutPlan); @override int findIndexById(int? id) => (super.noSuchMethod( @@ -964,94 +982,94 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i22.WorkoutPlansProv ); @override - _i19.Future fetchAndSetAllPlansFull() => (super.noSuchMethod( + _i20.Future fetchAndSetAllPlansFull() => (super.noSuchMethod( Invocation.method( #fetchAndSetAllPlansFull, [], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( + _i20.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( Invocation.method( #fetchAndSetAllPlansSparse, [], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future<_i12.WorkoutPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod( + _i20.Future<_i13.WorkoutPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod( Invocation.method( #fetchAndSetPlanSparse, [planId], ), - returnValue: _i19.Future<_i12.WorkoutPlan>.value(_FakeWorkoutPlan_12( + returnValue: _i20.Future<_i13.WorkoutPlan>.value(_FakeWorkoutPlan_13( this, Invocation.method( #fetchAndSetPlanSparse, [planId], ), )), - ) as _i19.Future<_i12.WorkoutPlan>); + ) as _i20.Future<_i13.WorkoutPlan>); @override - _i19.Future<_i12.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) => (super.noSuchMethod( + _i20.Future<_i13.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) => (super.noSuchMethod( Invocation.method( #fetchAndSetWorkoutPlanFull, [workoutId], ), - returnValue: _i19.Future<_i12.WorkoutPlan>.value(_FakeWorkoutPlan_12( + returnValue: _i20.Future<_i13.WorkoutPlan>.value(_FakeWorkoutPlan_13( this, Invocation.method( #fetchAndSetWorkoutPlanFull, [workoutId], ), )), - ) as _i19.Future<_i12.WorkoutPlan>); + ) as _i20.Future<_i13.WorkoutPlan>); @override - _i19.Future<_i12.WorkoutPlan> addWorkout(_i12.WorkoutPlan? workout) => (super.noSuchMethod( + _i20.Future<_i13.WorkoutPlan> addWorkout(_i13.WorkoutPlan? workout) => (super.noSuchMethod( Invocation.method( #addWorkout, [workout], ), - returnValue: _i19.Future<_i12.WorkoutPlan>.value(_FakeWorkoutPlan_12( + returnValue: _i20.Future<_i13.WorkoutPlan>.value(_FakeWorkoutPlan_13( this, Invocation.method( #addWorkout, [workout], ), )), - ) as _i19.Future<_i12.WorkoutPlan>); + ) as _i20.Future<_i13.WorkoutPlan>); @override - _i19.Future editWorkout(_i12.WorkoutPlan? workout) => (super.noSuchMethod( + _i20.Future editWorkout(_i13.WorkoutPlan? workout) => (super.noSuchMethod( Invocation.method( #editWorkout, [workout], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future deleteWorkout(int? id) => (super.noSuchMethod( + _i20.Future deleteWorkout(int? id) => (super.noSuchMethod( Invocation.method( #deleteWorkout, [id], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future> fetchLogData( - _i12.WorkoutPlan? workout, - _i3.Exercise? base, + _i20.Future> fetchLogData( + _i13.WorkoutPlan? workout, + _i4.Exercise? base, ) => (super.noSuchMethod( Invocation.method( @@ -1061,43 +1079,43 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i22.WorkoutPlansProv base, ], ), - returnValue: _i19.Future>.value({}), - ) as _i19.Future>); + returnValue: _i20.Future>.value({}), + ) as _i20.Future>); @override - _i19.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( + _i20.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( Invocation.method( #fetchAndSetRepetitionUnits, [], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future fetchAndSetWeightUnits() => (super.noSuchMethod( + _i20.Future fetchAndSetWeightUnits() => (super.noSuchMethod( Invocation.method( #fetchAndSetWeightUnits, [], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future fetchAndSetUnits() => (super.noSuchMethod( + _i20.Future fetchAndSetUnits() => (super.noSuchMethod( Invocation.method( #fetchAndSetUnits, [], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future<_i13.Day> addDay( - _i13.Day? day, - _i12.WorkoutPlan? workout, + _i20.Future<_i14.Day> addDay( + _i14.Day? day, + _i13.WorkoutPlan? workout, ) => (super.noSuchMethod( Invocation.method( @@ -1107,7 +1125,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i22.WorkoutPlansProv workout, ], ), - returnValue: _i19.Future<_i13.Day>.value(_FakeDay_13( + returnValue: _i20.Future<_i14.Day>.value(_FakeDay_14( this, Invocation.method( #addDay, @@ -1117,56 +1135,56 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i22.WorkoutPlansProv ], ), )), - ) as _i19.Future<_i13.Day>); + ) as _i20.Future<_i14.Day>); @override - _i19.Future editDay(_i13.Day? day) => (super.noSuchMethod( + _i20.Future editDay(_i14.Day? day) => (super.noSuchMethod( Invocation.method( #editDay, [day], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future deleteDay(_i13.Day? day) => (super.noSuchMethod( + _i20.Future deleteDay(_i14.Day? day) => (super.noSuchMethod( Invocation.method( #deleteDay, [day], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future<_i14.Set> addSet(_i14.Set? workoutSet) => (super.noSuchMethod( + _i20.Future<_i15.Set> addSet(_i15.Set? workoutSet) => (super.noSuchMethod( Invocation.method( #addSet, [workoutSet], ), - returnValue: _i19.Future<_i14.Set>.value(_FakeSet_14( + returnValue: _i20.Future<_i15.Set>.value(_FakeSet_15( this, Invocation.method( #addSet, [workoutSet], ), )), - ) as _i19.Future<_i14.Set>); + ) as _i20.Future<_i15.Set>); @override - _i19.Future editSet(_i14.Set? workoutSet) => (super.noSuchMethod( + _i20.Future editSet(_i15.Set? workoutSet) => (super.noSuchMethod( Invocation.method( #editSet, [workoutSet], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future> reorderSets( - List<_i14.Set>? sets, + _i20.Future> reorderSets( + List<_i15.Set>? sets, int? startIndex, ) => (super.noSuchMethod( @@ -1177,22 +1195,22 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i22.WorkoutPlansProv startIndex, ], ), - returnValue: _i19.Future>.value(<_i14.Set>[]), - ) as _i19.Future>); + returnValue: _i20.Future>.value(<_i15.Set>[]), + ) as _i20.Future>); @override - _i19.Future fetchComputedSettings(_i14.Set? workoutSet) => (super.noSuchMethod( + _i20.Future fetchComputedSettings(_i15.Set? workoutSet) => (super.noSuchMethod( Invocation.method( #fetchComputedSettings, [workoutSet], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future fetchSmartText( - _i14.Set? workoutSet, + _i20.Future fetchSmartText( + _i15.Set? workoutSet, _i23.Translation? exercise, ) => (super.noSuchMethod( @@ -1203,7 +1221,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i22.WorkoutPlansProv exercise, ], ), - returnValue: _i19.Future.value(_i24.dummyValue( + returnValue: _i20.Future.value(_i24.dummyValue( this, Invocation.method( #fetchSmartText, @@ -1213,81 +1231,81 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i22.WorkoutPlansProv ], ), )), - ) as _i19.Future); + ) as _i20.Future); @override - _i19.Future deleteSet(_i14.Set? workoutSet) => (super.noSuchMethod( + _i20.Future deleteSet(_i15.Set? workoutSet) => (super.noSuchMethod( Invocation.method( #deleteSet, [workoutSet], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future<_i15.Setting> addSetting(_i15.Setting? workoutSetting) => (super.noSuchMethod( + _i20.Future<_i16.Setting> addSetting(_i16.Setting? workoutSetting) => (super.noSuchMethod( Invocation.method( #addSetting, [workoutSetting], ), - returnValue: _i19.Future<_i15.Setting>.value(_FakeSetting_15( + returnValue: _i20.Future<_i16.Setting>.value(_FakeSetting_16( this, Invocation.method( #addSetting, [workoutSetting], ), )), - ) as _i19.Future<_i15.Setting>); + ) as _i20.Future<_i16.Setting>); @override - _i19.Future fetchSessionData() => (super.noSuchMethod( + _i20.Future fetchSessionData() => (super.noSuchMethod( Invocation.method( #fetchSessionData, [], ), - returnValue: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + ) as _i20.Future); @override - _i19.Future<_i16.WorkoutSession> addSession(_i16.WorkoutSession? session) => (super.noSuchMethod( + _i20.Future<_i17.WorkoutSession> addSession(_i17.WorkoutSession? session) => (super.noSuchMethod( Invocation.method( #addSession, [session], ), - returnValue: _i19.Future<_i16.WorkoutSession>.value(_FakeWorkoutSession_16( + returnValue: _i20.Future<_i17.WorkoutSession>.value(_FakeWorkoutSession_17( this, Invocation.method( #addSession, [session], ), )), - ) as _i19.Future<_i16.WorkoutSession>); + ) as _i20.Future<_i17.WorkoutSession>); @override - _i19.Future<_i17.Log> addLog(_i17.Log? log) => (super.noSuchMethod( + _i20.Future<_i18.Log> addLog(_i18.Log? log) => (super.noSuchMethod( Invocation.method( #addLog, [log], ), - returnValue: _i19.Future<_i17.Log>.value(_FakeLog_17( + returnValue: _i20.Future<_i18.Log>.value(_FakeLog_18( this, Invocation.method( #addLog, [log], ), )), - ) as _i19.Future<_i17.Log>); + ) as _i20.Future<_i18.Log>); @override - _i19.Future deleteLog(_i17.Log? log) => (super.noSuchMethod( + _i20.Future deleteLog(_i18.Log? log) => (super.noSuchMethod( Invocation.method( #deleteLog, [log], ), - returnValue: _i19.Future.value(), - returnValueForMissingStub: _i19.Future.value(), - ) as _i19.Future); + returnValue: _i20.Future.value(), + returnValueForMissingStub: _i20.Future.value(), + ) as _i20.Future); @override void addListener(_i21.VoidCallback? listener) => super.noSuchMethod(