Skip to content

Commit

Permalink
Updated to include new test and fixed failed test.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Yue committed Jan 14, 2025
1 parent 11324ce commit b1b6eb3
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class ConvivaAnalyticsIntegrationTest {
adAnalytics,
ssaiApi,
)
convivaAnalyticsIntegration.initializeSession()
clearMocks(videoAnalytics, answers = true)
}

@After
Expand Down Expand Up @@ -177,6 +179,8 @@ class ConvivaAnalyticsIntegrationTest {

@Test
fun `does not report a playback error when receiving a player warning event without active conviva session`() {
convivaAnalyticsIntegration.endSession()

player.listeners[PlayerEvent.Warning::class]?.forEach { onEvent ->
onEvent(PlayerEvent.Warning(PlayerWarningCode.General, "warning"))
}
Expand All @@ -185,12 +189,26 @@ class ConvivaAnalyticsIntegrationTest {

@Test
fun `does not report a playback error when receiving a source warning event without active conviva session`() {
convivaAnalyticsIntegration.endSession()

player.listeners[SourceEvent.Warning::class]?.forEach { onEvent ->
onEvent(SourceEvent.Warning(SourceWarningCode.General, "warning"))
}
verify(exactly = 0) { videoAnalytics.reportPlaybackError(any(), any()) }
}

@Test
fun `does not report a playback stalled without active conviva session`() {
convivaAnalyticsIntegration.reportPlaybackStalled()
verify(exactly = 1) { videoAnalytics.reportPlaybackMetric(any(), any()) }

convivaAnalyticsIntegration.endSession()
clearMocks(videoAnalytics, answers = true)

convivaAnalyticsIntegration.reportPlaybackStalled()
verify(exactly = 0) { videoAnalytics.reportPlaybackMetric(any(), any()) }
}

@Test
fun `reports CSAI ad position based on last ad break schedule time`() {
player.listeners[PlayerEvent.AdBreakStarted::class]?.forEach {
Expand Down

0 comments on commit b1b6eb3

Please sign in to comment.