I tried the approach in Simona Stojanovic @simona-anomis Medium article but it doesn't work for proto datastore. The issue is that testCoroutineScope.runBlockingTest gives me an error.
The entire code is the same as in the Medium article except for the part where the datastore is created:
The error I get states that This job has not completed yet:
java.lang.IllegalStateException: This job has not completed yet
at kotlinx.coroutines.JobSupport.getCompletionExceptionOrNull(JobSupport.kt:1190)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersDeprecatedKt.runBlockingTest(TestBuildersDeprecated.kt:67)
at kotlinx.coroutines.test.TestBuildersKt.runBlockingTest(Unknown Source:1)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersDeprecatedKt.runBlockingTest(TestBuildersDeprecated.kt:126)
at kotlinx.coroutines.test.TestBuildersKt.runBlockingTest(Unknown Source:1)
at com.xkcd.comiclist_data.repository.XkcdSettingsRepositoryImplTest.dummyTest(XkcdSettingsRepositoryImplTest.kt:60)
I tried the approach in Simona Stojanovic @simona-anomis Medium article but it doesn't work for proto datastore. The issue is that
testCoroutineScope.runBlockingTest
gives me an error.The entire code is the same as in the Medium article except for the part where the datastore is created:
This is the full test file I run as an Instrumented Test:
The error I get states that
This job has not completed yet
:Here is the full
XkcdSettingsRepositoryImpl
: