refactor widget tests

This commit is contained in:
Adam Velebil 2023-10-20 11:38:36 +02:00
parent 055a68b182
commit 65df45e091
No known key found for this signature in database
GPG Key ID: C9B1E4A3CBBD2E10

View File

@ -352,12 +352,7 @@ void main() {
testWidgets('NFC options visible on device with NFC support', testWidgets('NFC options visible on device with NFC support',
(WidgetTester tester) async { (WidgetTester tester) async {
SharedPreferences sharedPrefs = await SharedPreferences.getInstance(); await tester.pumpWidget(await androidWidget(hasNfcSupport: true));
await tester.pumpWidget(await androidWidget(
sharedPrefs: sharedPrefs,
hasNfcSupport: true,
));
expect(find.byKey(android_keys.nfcTapSetting), findsOneWidget); expect(find.byKey(android_keys.nfcTapSetting), findsOneWidget);
expect(find.byKey(android_keys.nfcKeyboardLayoutSetting), findsOneWidget); expect(find.byKey(android_keys.nfcKeyboardLayoutSetting), findsOneWidget);
@ -367,12 +362,7 @@ void main() {
testWidgets('NFC options hidden on device without NFC support', testWidgets('NFC options hidden on device without NFC support',
(WidgetTester tester) async { (WidgetTester tester) async {
SharedPreferences sharedPrefs = await SharedPreferences.getInstance(); await tester.pumpWidget(await androidWidget(hasNfcSupport: false));
await tester.pumpWidget(await androidWidget(
sharedPrefs: sharedPrefs,
hasNfcSupport: false,
));
expect(find.byKey(android_keys.nfcTapSetting), findsNothing); expect(find.byKey(android_keys.nfcTapSetting), findsNothing);
expect(find.byKey(android_keys.nfcKeyboardLayoutSetting), findsNothing); expect(find.byKey(android_keys.nfcKeyboardLayoutSetting), findsNothing);