Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
permission_handler
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
songyanzhi
permission_handler
Commits
ff899284
Commit
ff899284
authored
Mar 15, 2021
by
Jan-Derk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests added and updated
parent
357df54f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
0 deletions
+27
-0
permission_handler_platform_interface/test/src/method_channel/method_channel_permission_handler_test.dart
+19
-0
permission_handler_platform_interface/test/src/permission_status_test.dart
+2
-0
permission_handler_platform_interface/test/src/permissions_test.dart
+6
-0
No files found.
permission_handler_platform_interface/test/src/method_channel/method_channel_permission_handler_test.dart
View file @
ff899284
...
@@ -6,6 +6,8 @@ import 'method_channel_mock.dart';
...
@@ -6,6 +6,8 @@ import 'method_channel_mock.dart';
List
<
Permission
>
get
mockPermissions
=>
List
.
of
(
List
<
Permission
>
get
mockPermissions
=>
List
.
of
(
<
Permission
>{
Permission
.
calendar
,
Permission
.
camera
,
Permission
.
contacts
});
<
Permission
>{
Permission
.
calendar
,
Permission
.
camera
,
Permission
.
contacts
});
Map
<
Permission
,
PermissionStatus
>
get
mockPermissionMap
=>
{};
void
main
(
)
{
void
main
(
)
{
TestWidgetsFlutterBinding
.
ensureInitialized
();
TestWidgetsFlutterBinding
.
ensureInitialized
();
...
@@ -163,6 +165,23 @@ void main() {
...
@@ -163,6 +165,23 @@ void main() {
});
});
});
});
group
(
'requestPermissions: When requesting for permission'
,
()
{
// ignore: lines_longer_than_80_chars
test
(
'returns a Map with all the PermissionStatus of the given permissions'
,
()
async
{
MethodChannelMock
(
channelName:
'flutter.baseflow.com/permissions/methods'
,
method:
'requestPermissions'
,
result:
mockPermissionMap
,
);
final
result
=
await
MethodChannelPermissionHandler
()
.
requestPermissions
(
mockPermissions
);
expect
(
result
,
isA
<
Map
<
Permission
,
PermissionStatus
>>());
});
});
group
(
'shouldShowRequestPermissionRationale:'
,
()
{
group
(
'shouldShowRequestPermissionRationale:'
,
()
{
test
(
test
(
// ignore: lines_longer_than_80_chars
// ignore: lines_longer_than_80_chars
...
...
permission_handler_platform_interface/test/src/permission_status_test.dart
View file @
ff899284
...
@@ -60,4 +60,6 @@ void main() {
...
@@ -60,4 +60,6 @@ void main() {
expect
(
PermissionStatus
.
permanentlyDenied
.
isDenied
,
false
);
expect
(
PermissionStatus
.
permanentlyDenied
.
isDenied
,
false
);
});
});
});
});
test
(
'test'
,
()
{});
}
}
permission_handler_platform_interface/test/src/permissions_test.dart
View file @
ff899284
...
@@ -16,4 +16,10 @@ void main() {
...
@@ -16,4 +16,10 @@ void main() {
expect
(
values
[
i
],
Permission
.
byValue
(
i
));
expect
(
values
[
i
],
Permission
.
byValue
(
i
));
}
}
});
});
test
(
'check if byValue returns corresponding PermissionGroup value'
,
()
{
var
permissionWithService
=
PermissionWithService
.
private
(
0
);
var
permissionName
=
permissionWithService
.
toString
();
expect
(
permissionName
,
'Permission.calendar'
);
});
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment