-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathScopeProviderStub.kt
More file actions
33 lines (29 loc) · 1.32 KB
/
ScopeProviderStub.kt
File metadata and controls
33 lines (29 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package io.customer.commontest.util
import io.customer.sdk.core.util.ScopeProvider
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.UnconfinedTestDispatcher
class ScopeProviderStub private constructor(
override val eventBusScope: TestScope,
override val lifecycleListenerScope: TestScope,
override val inAppLifecycleScope: TestScope,
override val locationScope: TestScope
) : ScopeProvider {
@Suppress("FunctionName")
companion object {
@OptIn(ExperimentalCoroutinesApi::class)
fun Unconfined(): ScopeProviderStub = ScopeProviderStub(
eventBusScope = TestScope(UnconfinedTestDispatcher()),
lifecycleListenerScope = TestScope(UnconfinedTestDispatcher()),
inAppLifecycleScope = TestScope(UnconfinedTestDispatcher()),
locationScope = TestScope(UnconfinedTestDispatcher())
)
fun Standard(): ScopeProviderStub = ScopeProviderStub(
eventBusScope = TestScope(StandardTestDispatcher()),
lifecycleListenerScope = TestScope(StandardTestDispatcher()),
inAppLifecycleScope = TestScope(StandardTestDispatcher()),
locationScope = TestScope(StandardTestDispatcher())
)
}
}