File tree Expand file tree Collapse file tree 2 files changed +19
-11
lines changed
main/java/com/urbanairship/analytics
test/java/com/urbanairship/analytics Expand file tree Collapse file tree 2 files changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -261,17 +261,7 @@ public constructor(
261261 * @param event The region event.
262262 */
263263 public fun recordCustomEvent (event : CustomEvent ) {
264- if (! addEvent(event)) {
265- return
266- }
267-
268- eventFeed.emit(
269- AirshipEventFeed .Event .Analytics (
270- event.type,
271- event.toJsonValue(),
272- event.eventValue?.toDouble()
273- )
274- )
264+ addEvent(event)
275265 }
276266
277267 /* *
Original file line number Diff line number Diff line change @@ -213,6 +213,24 @@ public class AnalyticsTest {
213213 coVerify(exactly = 0 ) { mockEventManager.addEvent(any(), any()) }
214214 }
215215
216+ @Test
217+ public fun testCustomEventFeed (): TestResult = runTest(testDispatcher) {
218+ val event = CustomEvent .newBuilder(" cool" ).build()
219+ analytics.recordCustomEvent(event)
220+
221+ advanceUntilIdle()
222+
223+ val expectedFeedEvent = AirshipEventFeed .Event .Analytics (
224+ event.type,
225+ event.toJsonValue(),
226+ event.eventValue?.toDouble()
227+ )
228+
229+ verify(exactly = 1 ) {
230+ mockEventFeed.emit(expectedFeedEvent)
231+ }
232+ }
233+
216234 /* *
217235 * Test adding an invalid event
218236 */
You can’t perform that action at this time.
0 commit comments