Skip to content

Commit

Permalink
test: fix static analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
noxasch committed Dec 13, 2023
1 parent 747b955 commit ca6e8f5
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 33 deletions.
40 changes: 21 additions & 19 deletions app_widget/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -465,25 +465,27 @@ void main() {
const MethodChannel channel = MethodChannel(AppWidgetPlatform.channel);
final List<MethodCall> log = <MethodCall>[];
channel.setMockMethodCallHandler((methodCall) async {
log.add(methodCall);
switch (methodCall.method) {
case 'configureWidget':
return true;
case 'cancelConfigureWidget':
return true;
case 'getWidgetIds':
return [42];
case 'reloadWidgets':
return true;
case 'updateWidget':
return true;
case 'widgetExist':
return true;
default:
}
});
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(channel, (methodCall) async {
log.add(methodCall);
switch (methodCall.method) {
case 'getPlatformVersion':
return '42';
case 'configureWidget':
return true;
case 'cancelConfigureWidget':
return true;
case 'getWidgetIds':
return [];
case 'reloadWidgets':
return true;
case 'widgetExist':
return true;
default:
return null;
}
});
setUp(() {
Expand Down
5 changes: 3 additions & 2 deletions app_widget/test/app_widget_ios_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ void main() {
final List<MethodCall> log = <MethodCall>[];

setUpAll(() {
// ignore: always_specify_types
channel.setMockMethodCallHandler((methodCall) async {
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(channel, (methodCall) async {
log.add(methodCall);
switch (methodCall.method) {
case 'getPlatformVersion':
Expand All @@ -28,6 +28,7 @@ void main() {
case 'widgetExist':
return true;
default:
return null;
}
});
});
Expand Down
25 changes: 13 additions & 12 deletions app_widget/test/app_widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ void main() {
final List<MethodCall> log = <MethodCall>[];

setUpAll(() {
// ignore: always_specify_types
channel.setMockMethodCallHandler((methodCall) async {
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(channel, (methodCall) async {
log.add(methodCall);
switch (methodCall.method) {
case 'getPlatformVersion':
Expand All @@ -32,6 +32,7 @@ void main() {
case 'widgetExist':
return true;
default:
return false;
}
});
});
Expand Down Expand Up @@ -71,7 +72,7 @@ void main() {
'payload': '{"itemId": 1, "stringUid": "uid"}',
'url': 'https://google.come',
},
)
),
]);
});

Expand Down Expand Up @@ -102,7 +103,7 @@ void main() {
'payload': '{"itemId": 1, "stringUid": "uid"}',
'url': 'https://google.come',
},
)
),
]);
});

Expand Down Expand Up @@ -132,7 +133,7 @@ void main() {
'payload': '{"itemId": 1, "stringUid": "uid"}',
'url': 'https://google.come',
},
)
),
]);
});

Expand Down Expand Up @@ -163,7 +164,7 @@ void main() {
'payload': '{"itemId": 1, "stringUid": "uid"}',
'url': 'https://google.come',
},
)
),
]);
});

Expand All @@ -179,7 +180,7 @@ void main() {
isMethodCall(
'cancelConfigureWidget',
arguments: null,
)
),
]);
});

Expand All @@ -200,7 +201,7 @@ void main() {
'androidProviderName': 'TestProvider',
'androidPackageName': 'appname',
},
)
),
]);
});

Expand All @@ -222,7 +223,7 @@ void main() {
'androidProviderName': 'TestProvider',
'androidPackageName': 'appname2',
},
)
),
]);
});

Expand All @@ -243,7 +244,7 @@ void main() {
'androidProviderName': 'TestProvider',
'androidPackageName': 'appname',
},
)
),
]);
});

Expand All @@ -265,7 +266,7 @@ void main() {
'androidProviderName': 'TestProvider',
'androidPackageName': 'appname2',
},
)
),
]);
});

Expand All @@ -283,7 +284,7 @@ void main() {
arguments: <String, Object>{
'widgetId': 12,
},
)
),
]);
});
});
Expand Down

0 comments on commit ca6e8f5

Please sign in to comment.