Skip to content

Commit a55c9c9

Browse files
committed
Improve room test reliability
1 parent 0b7ae20 commit a55c9c9

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

integrations/room/src/commonIntegrationTest/kotlin/com/powersync/integrations/room/PowerSyncRoomTest.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ class PowerSyncRoomTest {
8888
turbine.awaitItem() shouldHaveSize 1
8989
turbine.cancel()
9090
}
91+
92+
powersync.close()
9193
}
9294

9395
@Test
@@ -108,6 +110,7 @@ class PowerSyncRoomTest {
108110
database.userDao().getAll() shouldHaveSize 0
109111
powersync.execute("insert into user values (uuid(), ?)", listOf("PowerSync user"))
110112
database.userDao().getAll() shouldHaveSize 1
113+
powersync.close()
111114
}
112115

113116
@Test
@@ -133,5 +136,7 @@ class PowerSyncRoomTest {
133136
turbine.awaitItem() shouldHaveSize 1
134137
turbine.cancel()
135138
}
139+
140+
powersync.close()
136141
}
137142
}

integrations/room/src/commonMain/kotlin/com/powersync/integrations/room/RoomConnectionPool.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public class RoomConnectionPool(
9191
val changed =
9292
it.usePrepared("SELECT powersync_update_hooks('get')") { stmt ->
9393
check(stmt.step())
94-
json.decodeFromString<Set<String>>(stmt.getText(0))
94+
Json.decodeFromString<Set<String>>(stmt.getText(0))
9595
}
9696

9797
val userTables =
@@ -114,10 +114,6 @@ public class RoomConnectionPool(
114114
override suspend fun close() {
115115
// Noop, Room database managed independently
116116
}
117-
118-
private companion object {
119-
val json = Json {}
120-
}
121117
}
122118

123119
private class RoomTransactionLease(

0 commit comments

Comments
 (0)