fix tests

This commit is contained in:
Milos Kozak 2023-01-10 13:11:28 +01:00
parent 5306e62f91
commit 9b8632239c
2 changed files with 4 additions and 2 deletions

View file

@ -35,8 +35,10 @@ open class TestBase {
fun setupLocale() {
Locale.setDefault(Locale.ENGLISH)
System.setProperty("disableFirebase", "true")
}
// Initialize WorkManager for instrumentation tests.
// Initialize WorkManager for instrumentation tests.
fun initWorkManager() {
WorkManagerTestInitHelper.initializeTestWorkManager(
context,
Configuration.Builder()
@ -44,7 +46,6 @@ open class TestBase {
.setExecutor(SynchronousExecutor())
.build()
)
}
// Workaround for Kotlin nullability.

View file

@ -90,6 +90,7 @@ internal class LoadBgWorkerTest : TestBase() {
@Test
fun doWork() = runTest {
initWorkManager()
nsClientV3Plugin.nsAndroidClient = nsAndroidClient
sut = TestListenableWorkerBuilder<LoadBgWorker>(context).build()
Mockito.`when`(nsAndroidClient.getSgvsNewerThan(anyLong(), anyLong())).thenReturn(NSAndroidClient.ReadResponse(200, 0, emptyList()))