-
Notifications
You must be signed in to change notification settings - Fork 9
/
MockCustomerIOBuilder.kt
47 lines (38 loc) · 1.29 KB
/
MockCustomerIOBuilder.kt
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package io.customer.sdk
import io.customer.sdk.api.CustomerIOApi
import io.customer.sdk.data.model.Region
import io.customer.sdk.data.store.CustomerIOStore
import org.mockito.kotlin.mock
internal class MockCustomerIOBuilder(private val customerIOConfig: CustomerIOConfig = defaultConfig) {
lateinit var api: CustomerIOApi
lateinit var store: CustomerIOStore
private lateinit var customerIO: CustomerIO
companion object {
const val apiKey = "mock-key"
const val siteId = "mock-site"
val region = Region.US
const val timeout = 6000
val urlHandler = null
const val shouldAutoRecordScreenViews = false
const val autoTrackDeviceAttributes = true
val defaultConfig = CustomerIOConfig(
apiKey = "mock-key",
siteId = "mock-site",
region = Region.US,
timeout = 6000,
urlHandler = urlHandler,
autoTrackScreenViews = shouldAutoRecordScreenViews,
autoTrackDeviceAttributes = autoTrackDeviceAttributes
)
}
fun build(): CustomerIO {
api = mock()
store = mock()
customerIO = CustomerIO(
config = customerIOConfig,
api = api,
store = store
)
return customerIO
}
}