Skip to content

Commit b582f7b

Browse files
committed
fix unit tests
1 parent fea0a85 commit b582f7b

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

core/src/test/kotlin/com/segment/analytics/kotlin/core/AnalyticsTests.kt

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,41 +1056,41 @@ class AsyncAnalyticsTests {
10561056
assertEquals(expectedAnonymousId, e.anonymousId)
10571057
}
10581058
}
1059-
//
1060-
// @Test
1061-
// fun `startup queue should replay with identify enrichment closure`() {
1062-
// val expected = buildJsonObject {
1063-
// put("foo", "baz")
1064-
// }
1065-
// val expectedUserId = "newUserId"
1066-
//
1067-
// analytics.add(afterPlugin)
1068-
// analytics.identify(expectedUserId) {
1069-
// if (it is IdentifyEvent) {
1070-
// it.traits = updateJsonObject(it.traits) {
1071-
// it["foo"] = "baz"
1072-
// }
1073-
// }
1074-
// it
1075-
// }
1076-
//
1077-
// // now we have tracked event, i.e. event added to startup queue
1078-
// // release the semaphore put on http client, so we startup queue will replay the events
1079-
// httpSemaphore.release()
1080-
// // now we need to wait for events being fully replayed before making assertions
1081-
// assertSemaphore.acquire()
1082-
//
1083-
// val actualUserId = analytics.userId()
1084-
//
1085-
// assertTrue(actual.isCaptured)
1086-
// actual.captured.let {
1087-
// assertTrue(it is IdentifyEvent)
1088-
// val e = it as IdentifyEvent
1089-
// assertEquals(expected, e.traits)
1090-
// assertEquals(expectedUserId, actualUserId)
1091-
// }
1092-
// }
1093-
//
1059+
1060+
@Test
1061+
fun `startup queue should replay with identify enrichment closure`() {
1062+
val expected = buildJsonObject {
1063+
put("foo", "baz")
1064+
}
1065+
val expectedUserId = "newUserId"
1066+
1067+
analytics.add(afterPlugin)
1068+
analytics.identify(expectedUserId) {
1069+
if (it is IdentifyEvent) {
1070+
it.traits = updateJsonObject(it.traits) {
1071+
it["foo"] = "baz"
1072+
}
1073+
}
1074+
it
1075+
}
1076+
1077+
// now we have tracked event, i.e. event added to startup queue
1078+
// release the semaphore put on http client, so we startup queue will replay the events
1079+
httpSemaphore.release()
1080+
// now we need to wait for events being fully replayed before making assertions
1081+
assertSemaphore.acquire()
1082+
1083+
val actualUserId = analytics.userId()
1084+
1085+
assertTrue(actual.isCaptured)
1086+
actual.captured.let {
1087+
assertTrue(it is IdentifyEvent)
1088+
val e = it as IdentifyEvent
1089+
assertEquals(expected, e.traits)
1090+
assertEquals(expectedUserId, actualUserId)
1091+
}
1092+
}
1093+
10941094
// @Test
10951095
// fun `startup queue should replay with group enrichment closure`() {
10961096
// val expected = buildJsonObject {

0 commit comments

Comments
 (0)