Browse Source

fix(neon,app): Correctly mock shared preferences in screenshot tests

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/702/head
jld3103 1 year ago
parent
commit
e4d32cc63a
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 3
      packages/app/integration_test/screenshot_test.dart
  2. 2
      packages/neon/neon/lib/settings.dart
  3. 1
      packages/neon/neon/lib/src/settings/models/storage.dart

3
packages/app/integration_test/screenshot_test.dart

@ -77,8 +77,9 @@ Future main() async {
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); await SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
}); });
setUp(() { setUp(() async {
SharedPreferences.setMockInitialValues({}); SharedPreferences.setMockInitialValues({});
NeonStorage.mock(await SharedPreferences.getInstance());
}); });
testWidgets('login', (final tester) async { testWidgets('login', (final tester) async {

2
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_category.dart';
export 'package:neon/src/settings/models/options_collection.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/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/models/toggle_option.dart';
export 'package:neon/src/settings/widgets/settings_list.dart'; export 'package:neon/src/settings/widgets/settings_list.dart';

1
packages/neon/neon/lib/src/settings/models/storage.dart

@ -36,7 +36,6 @@ enum StorageKeys implements Storable {
final String value; final String value;
} }
@internal
final class NeonStorage { final class NeonStorage {
/// Shared preferences instance. /// Shared preferences instance.
/// ///

Loading…
Cancel
Save