From e4d32cc63a107a77f1315623a0c46311cc93a2fb Mon Sep 17 00:00:00 2001 From: jld3103 Date: Wed, 30 Aug 2023 10:28:44 +0200 Subject: [PATCH] fix(neon,app): Correctly mock shared preferences in screenshot tests Signed-off-by: jld3103 --- packages/app/integration_test/screenshot_test.dart | 3 ++- packages/neon/neon/lib/settings.dart | 2 +- packages/neon/neon/lib/src/settings/models/storage.dart | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/app/integration_test/screenshot_test.dart b/packages/app/integration_test/screenshot_test.dart index e7c02673..8cb1edab 100644 --- a/packages/app/integration_test/screenshot_test.dart +++ b/packages/app/integration_test/screenshot_test.dart @@ -77,8 +77,9 @@ Future main() async { await SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); }); - setUp(() { + setUp(() async { SharedPreferences.setMockInitialValues({}); + NeonStorage.mock(await SharedPreferences.getInstance()); }); testWidgets('login', (final tester) async { diff --git a/packages/neon/neon/lib/settings.dart b/packages/neon/neon/lib/settings.dart index 08d29b5c..d028d34f 100644 --- a/packages/neon/neon/lib/settings.dart +++ b/packages/neon/neon/lib/settings.dart @@ -2,6 +2,6 @@ export 'package:neon/src/models/label_builder.dart'; export 'package:neon/src/settings/models/options_category.dart'; export 'package:neon/src/settings/models/options_collection.dart'; export 'package:neon/src/settings/models/select_option.dart'; -export 'package:neon/src/settings/models/storage.dart' show Storable; +export 'package:neon/src/settings/models/storage.dart' show NeonStorage, Storable; export 'package:neon/src/settings/models/toggle_option.dart'; export 'package:neon/src/settings/widgets/settings_list.dart'; diff --git a/packages/neon/neon/lib/src/settings/models/storage.dart b/packages/neon/neon/lib/src/settings/models/storage.dart index df865c61..dbf9b299 100644 --- a/packages/neon/neon/lib/src/settings/models/storage.dart +++ b/packages/neon/neon/lib/src/settings/models/storage.dart @@ -36,7 +36,6 @@ enum StorageKeys implements Storable { final String value; } -@internal final class NeonStorage { /// Shared preferences instance. ///