Skip to content

Commit

Permalink
ut
Browse files Browse the repository at this point in the history
  • Loading branch information
maureenorea-clores committed Jul 24, 2024
1 parent 33062c4 commit b8b9c61
Showing 1 changed file with 58 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -678,62 +678,62 @@ class InAppMessagingPrimerTrackerSpec : InAppMessagingSpec() {
verify(mockMgr).sendPrimerEvent(eq(1))
}

// @Test
// fun `should call primer manager with denied result`() {
// val inApp = initializeMockInstance(primerManager = mockMgr)
//
// inApp.trackPushPrimer(
// arrayOf(Manifest.permission.POST_NOTIFICATIONS), intArrayOf(PackageManager.PERMISSION_DENIED),
// )
//
// verify(mockMgr).sendPrimerEvent(eq(0), any())
// }
//
// @Test
// fun `should not call primer manager other permission`() {
// val inApp = initializeMockInstance(primerManager = mockMgr)
//
// inApp.trackPushPrimer(
// arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), intArrayOf(PackageManager.PERMISSION_DENIED),
// )
//
// verify(mockMgr, never()).sendPrimerEvent(any(), any())
// }
//
// @Test
// fun `should not call primer manager other permission and result higher size`() {
// val inApp = initializeMockInstance(primerManager = mockMgr)
//
// inApp.trackPushPrimer(
// arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
// intArrayOf(PackageManager.PERMISSION_DENIED, PackageManager.PERMISSION_GRANTED),
// )
//
// verify(mockMgr, never()).sendPrimerEvent(any(), any())
// }
//
// @Test
// fun `should not call primer manager other permission and permission higher size`() {
// val inApp = initializeMockInstance(primerManager = mockMgr)
//
// inApp.trackPushPrimer(
// arrayOf(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION),
// intArrayOf(PackageManager.PERMISSION_DENIED),
// )
//
// verify(mockMgr, never()).sendPrimerEvent(any(), any())
// }
//
// @Test
// @Config(sdk = [Build.VERSION_CODES.S])
// fun `should not call primer manager if lower than tiramisu`() {
// val inApp = initializeMockInstance(primerManager = mockMgr)
//
// inApp.trackPushPrimer(
// arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
// intArrayOf(PackageManager.PERMISSION_DENIED, PackageManager.PERMISSION_GRANTED),
// )
//
// verify(mockMgr, never()).sendPrimerEvent(any(), any())
// }
@Test
fun `should call primer manager with denied result`() {
val inApp = initializeMockInstance(primerManager = mockMgr)

inApp.trackPushPrimer(
arrayOf(Manifest.permission.POST_NOTIFICATIONS), intArrayOf(PackageManager.PERMISSION_DENIED),
)

verify(mockMgr).sendPrimerEvent(eq(0))
}

@Test
fun `should not call primer manager other permission`() {
val inApp = initializeMockInstance(primerManager = mockMgr)

inApp.trackPushPrimer(
arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), intArrayOf(PackageManager.PERMISSION_DENIED),
)

verify(mockMgr, never()).sendPrimerEvent(any())
}

@Test
fun `should not call primer manager other permission and result higher size`() {
val inApp = initializeMockInstance(primerManager = mockMgr)

inApp.trackPushPrimer(
arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
intArrayOf(PackageManager.PERMISSION_DENIED, PackageManager.PERMISSION_GRANTED),
)

verify(mockMgr, never()).sendPrimerEvent(any())
}

@Test
fun `should not call primer manager other permission and permission higher size`() {
val inApp = initializeMockInstance(primerManager = mockMgr)

inApp.trackPushPrimer(
arrayOf(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION),
intArrayOf(PackageManager.PERMISSION_DENIED),
)

verify(mockMgr, never()).sendPrimerEvent(any())
}

@Test
@Config(sdk = [Build.VERSION_CODES.S])
fun `should not call primer manager if lower than tiramisu`() {
val inApp = initializeMockInstance(primerManager = mockMgr)

inApp.trackPushPrimer(
arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
intArrayOf(PackageManager.PERMISSION_DENIED, PackageManager.PERMISSION_GRANTED),
)

verify(mockMgr, never()).sendPrimerEvent(any())
}
}

0 comments on commit b8b9c61

Please sign in to comment.