1515 */
1616package org.mobilenativefoundation.store.store5
1717
18+ import app.cash.turbine.test
1819import kotlinx.coroutines.CompletableDeferred
1920import kotlinx.coroutines.ExperimentalCoroutinesApi
2021import kotlinx.coroutines.FlowPreview
@@ -32,7 +33,6 @@ import org.mobilenativefoundation.store.store5.SourceOfTruth.WriteException
3233import org.mobilenativefoundation.store.store5.impl.PersistentSourceOfTruth
3334import org.mobilenativefoundation.store.store5.impl.SourceOfTruthWithBarrier
3435import org.mobilenativefoundation.store.store5.util.InMemoryPersister
35- import org.mobilenativefoundation.store.store5.util.assertEmitsExactly
3636import kotlin.test.Test
3737import kotlin.test.assertEquals
3838import kotlin.test.assertNull
@@ -147,19 +147,20 @@ class SourceOfTruthWithBarrierTests {
147147 persister.postReadCallback = { key, value ->
148148 throw exception
149149 }
150- assertEmitsExactly(
151- source.reader(1 , CompletableDeferred (Unit )),
152- listOf (
150+
151+ source.reader(1 , CompletableDeferred (Unit )).test {
152+ assertEquals (
153153 StoreReadResponse .Error .Exception (
154154 origin = StoreReadResponseOrigin .SourceOfTruth ,
155155 error =
156- ReadException (
157- key = 1 ,
158- cause = exception,
159- ),
156+ ReadException (
157+ key = 1 ,
158+ cause = exception,
159+ ),
160160 ),
161- ),
162- )
161+ awaitItem()
162+ )
163+ }
163164 }
164165
165166 @Test
@@ -187,10 +188,10 @@ class SourceOfTruthWithBarrierTests {
187188 StoreReadResponse .Error .Exception (
188189 origin = StoreReadResponseOrigin .SourceOfTruth ,
189190 error =
190- ReadException (
191- key = 1 ,
192- cause = exception,
193- ),
191+ ReadException (
192+ key = 1 ,
193+ cause = exception,
194+ ),
194195 ),
195196 collected.first(),
196197 )
@@ -204,10 +205,10 @@ class SourceOfTruthWithBarrierTests {
204205 StoreReadResponse .Error .Exception (
205206 origin = StoreReadResponseOrigin .SourceOfTruth ,
206207 error =
207- ReadException (
208- key = 1 ,
209- cause = exception,
210- ),
208+ ReadException (
209+ key = 1 ,
210+ cause = exception,
211+ ),
211212 ),
212213 StoreReadResponse .Data (
213214 // this is fetcher since we are using the write API
@@ -253,11 +254,11 @@ class SourceOfTruthWithBarrierTests {
253254 StoreReadResponse .Error .Exception (
254255 origin = StoreReadResponseOrigin .SourceOfTruth ,
255256 error =
256- WriteException (
257- key = 1 ,
258- value = failValue,
259- cause = exception,
260- ),
257+ WriteException (
258+ key = 1 ,
259+ value = failValue,
260+ cause = exception,
261+ ),
261262 ),
262263 StoreReadResponse .Data <String ?>(
263264 origin = StoreReadResponseOrigin .SourceOfTruth ,
0 commit comments