fix tests
This commit is contained in:
parent
5306e62f91
commit
9b8632239c
2 changed files with 4 additions and 2 deletions
|
@ -35,8 +35,10 @@ open class TestBase {
|
||||||
fun setupLocale() {
|
fun setupLocale() {
|
||||||
Locale.setDefault(Locale.ENGLISH)
|
Locale.setDefault(Locale.ENGLISH)
|
||||||
System.setProperty("disableFirebase", "true")
|
System.setProperty("disableFirebase", "true")
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize WorkManager for instrumentation tests.
|
// Initialize WorkManager for instrumentation tests.
|
||||||
|
fun initWorkManager() {
|
||||||
WorkManagerTestInitHelper.initializeTestWorkManager(
|
WorkManagerTestInitHelper.initializeTestWorkManager(
|
||||||
context,
|
context,
|
||||||
Configuration.Builder()
|
Configuration.Builder()
|
||||||
|
@ -44,7 +46,6 @@ open class TestBase {
|
||||||
.setExecutor(SynchronousExecutor())
|
.setExecutor(SynchronousExecutor())
|
||||||
.build()
|
.build()
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Workaround for Kotlin nullability.
|
// Workaround for Kotlin nullability.
|
||||||
|
|
|
@ -90,6 +90,7 @@ internal class LoadBgWorkerTest : TestBase() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun doWork() = runTest {
|
fun doWork() = runTest {
|
||||||
|
initWorkManager()
|
||||||
nsClientV3Plugin.nsAndroidClient = nsAndroidClient
|
nsClientV3Plugin.nsAndroidClient = nsAndroidClient
|
||||||
sut = TestListenableWorkerBuilder<LoadBgWorker>(context).build()
|
sut = TestListenableWorkerBuilder<LoadBgWorker>(context).build()
|
||||||
Mockito.`when`(nsAndroidClient.getSgvsNewerThan(anyLong(), anyLong())).thenReturn(NSAndroidClient.ReadResponse(200, 0, emptyList()))
|
Mockito.`when`(nsAndroidClient.getSgvsNewerThan(anyLong(), anyLong())).thenReturn(NSAndroidClient.ReadResponse(200, 0, emptyList()))
|
||||||
|
|
Loading…
Reference in a new issue