Skip to content

Commit 04dfc69

Browse files
committed
Another test
1 parent 5717d8d commit 04dfc69

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

core/src/commonIntegrationTest/kotlin/com/powersync/DatabaseTest.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.powersync
22

3+
import app.cash.turbine.test
34
import app.cash.turbine.turbineScope
45
import co.touchlab.kermit.ExperimentalKermitApi
56
import com.powersync.db.ActiveDatabaseGroup
@@ -441,6 +442,9 @@ class DatabaseTest {
441442
}
442443
}
443444

445+
// Before inserting data, the flow should be empty
446+
database.getCrudTransactions().test { awaitComplete() }
447+
444448
insertInTransaction(5)
445449
insertInTransaction(10)
446450
insertInTransaction(15)

core/src/commonMain/kotlin/com/powersync/PowerSyncDatabase.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public interface PowerSyncDatabase : Queries {
137137
public suspend fun getNextCrudTransaction(): CrudTransaction? = getCrudTransactions().firstOrNull()
138138

139139
/**
140-
* Obtains a flow of transactions with local data against the database.
140+
* Obtains a flow emitting completed transactions with local writes against the database.
141141
142142
* This is typically used from the [PowerSyncBackendConnector.uploadData] callback.
143143
* Each entry emitted by the returned flow is a full transaction containing all local writes
@@ -154,7 +154,7 @@ public interface PowerSyncDatabase : Queries {
154154
* val batch = mutableListOf<CrudEntry>()
155155
* var lastTx: CrudTransaction? = null
156156
*
157-
* database.getCrudTransactions().takeWhile { batch.size < 10 }.collect {
157+
* database.getCrudTransactions().takeWhile { batch.size < 100 }.collect {
158158
* batch.addAll(it.crud)
159159
* lastTx = it
160160
* }

0 commit comments

Comments
 (0)