-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from sshah112/Add-isInitialized-to-PermissionP…
…rovider add isInitialized() to PermissionProvider
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
lib/src/test/java/dev/marcelpinto/permissionktx/PermissionProviderTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package dev.marcelpinto.permissionktx | ||
|
||
import com.google.common.truth.Truth.assertThat | ||
import kotlinx.coroutines.flow.emptyFlow | ||
import org.junit.Test | ||
|
||
class PermissionProviderTest { | ||
|
||
|
||
private val fakeChecker = object : PermissionChecker { | ||
override fun getStatus(type: Permission) = PermissionStatus.Granted(Permission("any")) | ||
} | ||
|
||
private val dummyObserver = object : PermissionObserver { | ||
override fun getStatusFlow(type: Permission) = emptyFlow<PermissionStatus>() | ||
override fun refreshStatus() {} | ||
} | ||
|
||
@Test | ||
fun `test isInitialized when PermissionProvider is initialized`() { | ||
assertThat(PermissionProvider.isInitialized()).isFalse() | ||
PermissionProvider.init(fakeChecker, dummyObserver) | ||
assertThat(PermissionProvider.isInitialized()).isTrue() | ||
} | ||
} |