Skip to content

Commit

Permalink
fix(android): fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
abhaysood committed Oct 4, 2023
1 parent ac3c7eb commit 6dd5cde
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ internal class StorageImplTest {
fun `Storage writes the event to event log, when event log file is empty`() {
val sessionId = "id"
val data: JsonElement = Json.encodeToJsonElement("data")
val timestamp = 9876543210.iso8601Timestamp()
val event = Event(
timestamp = 9876543210.iso8601Timestamp(), type = "event", data = data
timestamp = timestamp, type = "event", data = data
)
`when`(fileHelper.isEventLogEmpty(sessionId)).thenReturn(true)
val eventLogFile = File(tempDirPath, "event_log")
Expand All @@ -111,7 +112,7 @@ internal class StorageImplTest {
// Then
assertEquals(
"""
{"timestamp": "1970-04-25T12:59:03.000000210Z","type": "event","event": "data"}
{"timestamp": "$timestamp","type": "event","event": "data"}
""".trimIndent(), eventLogFile.readText()
)
}
Expand All @@ -120,8 +121,9 @@ internal class StorageImplTest {
fun `Storage appends event to event log, when event log file is not empty`() {
val sessionId = "id"
val data: JsonElement = Json.encodeToJsonElement("data")
val timestamp = 9876543210.iso8601Timestamp()
val event = Event(
timestamp = 9876543210.iso8601Timestamp(), type = "event", data = data
timestamp = timestamp, type = "event", data = data
)
`when`(fileHelper.isEventLogEmpty(sessionId)).thenReturn(false)
val eventLogFile = File(tempDirPath, "event_log")
Expand All @@ -136,7 +138,7 @@ internal class StorageImplTest {
assertEquals(
"""
{"timestamp": "1970-04-25T12:59:03.000000210Z","type": "event","event": "data"}
{"timestamp": "$timestamp","type": "event","event": "data"}
""".trimIndent(), eventLogFile.readText()
)
}
Expand Down

0 comments on commit 6dd5cde

Please sign in to comment.