Commit 59c9101b by Jan-Derk

Added tests

parent b21af21a
import 'package:flutter/cupertino.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart'; import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart';
import 'package:permission_handler_platform_interface/src/method_channel/method_channel_permission_handler.dart'; import 'package:permission_handler_platform_interface/src/method_channel/method_channel_permission_handler.dart';
import 'method_channel_mock.dart'; import 'method_channel_mock.dart';
List<Permission> get mockPermissions => List.of(
<Permission>{Permission.calendar, Permission.camera, Permission.contacts});
void main() { void main() {
TestWidgetsFlutterBinding.ensureInitialized(); TestWidgetsFlutterBinding.ensureInitialized();
...@@ -141,8 +143,8 @@ void main() { ...@@ -141,8 +143,8 @@ void main() {
result: true, result: true,
); );
final hasOpenedAppSettings = await final hasOpenedAppSettings =
MethodChannelPermissionHandler().openAppSettings(); await MethodChannelPermissionHandler().openAppSettings();
expect(hasOpenedAppSettings, true); expect(hasOpenedAppSettings, true);
}); });
...@@ -154,16 +156,10 @@ void main() { ...@@ -154,16 +156,10 @@ void main() {
result: false, result: false,
); );
final hasOpenedAppSettings = await final hasOpenedAppSettings =
MethodChannelPermissionHandler().openAppSettings(); await MethodChannelPermissionHandler().openAppSettings();
expect(hasOpenedAppSettings, false); expect(hasOpenedAppSettings, false);
}); });
}); });
group('requestPermissions: When requesting for permission', (){
test('requestPermission', (){
});
});
} }
...@@ -25,7 +25,8 @@ void main() { ...@@ -25,7 +25,8 @@ void main() {
expect(PermissionStatusValue.statusByValue(1), PermissionStatus.denied); expect(PermissionStatusValue.statusByValue(1), PermissionStatus.denied);
expect(PermissionStatusValue.statusByValue(2), PermissionStatus.restricted); expect(PermissionStatusValue.statusByValue(2), PermissionStatus.restricted);
expect(PermissionStatusValue.statusByValue(3), PermissionStatus.limited); expect(PermissionStatusValue.statusByValue(3), PermissionStatus.limited);
expect(PermissionStatusValue.statusByValue(4), PermissionStatus.permanentlyDenied); expect(PermissionStatusValue.statusByValue(4),
PermissionStatus.permanentlyDenied);
}); });
//TODO: Kan je de Getters testen? //TODO: Kan je de Getters testen?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment