diff --git a/parsely/src/test/java/com/parsely/parselyandroid/EngagementManagerTest.kt b/parsely/src/test/java/com/parsely/parselyandroid/EngagementManagerTest.kt index 75f3c551..e6a9b4d2 100644 --- a/parsely/src/test/java/com/parsely/parselyandroid/EngagementManagerTest.kt +++ b/parsely/src/test/java/com/parsely/parselyandroid/EngagementManagerTest.kt @@ -62,26 +62,6 @@ internal class EngagementManagerTest { ) } - private fun MapAssert.isCorrectEvent( - withTotalTime: AbstractLongAssert<*>.() -> AbstractLongAssert<*>, - withTimestamp: AbstractLongAssert<*>.() -> AbstractLongAssert<*>, - ): MapAssert { - return containsEntry("action", "heartbeat") - // Incremental will be always 0 because the interval is lower than 1s - .containsEntry("inc", 0L) - .hasEntrySatisfying("tt") { totalTime -> - totalTime as Long - assertThat(totalTime).withTotalTime() - } - .hasEntrySatisfying("data") { data -> - data as Map - assertThat(data).hasEntrySatisfying("ts") { timestamp -> - timestamp as Long - assertThat(timestamp).withTimestamp() - }.containsAllEntriesOf(testData) - } - } - @Test fun `when starting manager, then schedule task each interval period`() { sut.start() @@ -120,6 +100,26 @@ internal class EngagementManagerTest { ) } + private fun MapAssert.isCorrectEvent( + withTotalTime: AbstractLongAssert<*>.() -> AbstractLongAssert<*>, + withTimestamp: AbstractLongAssert<*>.() -> AbstractLongAssert<*>, + ): MapAssert { + return containsEntry("action", "heartbeat") + // Incremental will be always 0 because the interval is lower than 1s + .containsEntry("inc", 0L) + .hasEntrySatisfying("tt") { totalTime -> + totalTime as Long + assertThat(totalTime).withTotalTime() + } + .hasEntrySatisfying("data") { data -> + data as Map + assertThat(data).hasEntrySatisfying("ts") { timestamp -> + timestamp as Long + assertThat(timestamp).withTimestamp() + }.containsAllEntriesOf(testData) + } + } + class FakeTracker : ParselyTracker( "", 0,