Skip to content

Commit e8ddd7e

Browse files
committed
LIBMOBILE-1084
- refactored AdjustDestination and AdjustDestinationTests.kt
1 parent 0150b8b commit e8ddd7e

File tree

2 files changed

+24
-21
lines changed

2 files changed

+24
-21
lines changed

lib/src/main/java/com/segment/analytics/kotlin/destinations/adjust/AdjustDestination.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ import kotlinx.serialization.json.put
2424
* @see <a href="https://github.com/adjust/android_sdk">Adjust Android SDK</a>
2525
*/
2626
class AdjustDestination : DestinationPlugin(), AndroidLifecycle {
27-
27+
companion object {
28+
private const val REVENUE_KEY = "revenue"
29+
private const val CURRENCY_KEY = "currency"
30+
}
2831
internal var settings: AdjustSettings? = null
2932

30-
private val REVENUE_KEY = "revenue"
31-
private val CURRENCY_KEY = "currency"
32-
3333
override val key: String = "Adjust"
3434

3535
override fun update(settings: Settings, type: Plugin.UpdateType) {

lib/src/test/kotlin/com/segment/analytics/kotlin/destinations/adjust/AdjustDestinationTests.kt

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ class AdjustDestinationTests {
7979
/* assertions Adjust config */
8080
assertNotNull(adjustDestination.settings)
8181
with(adjustDestination.settings!!) {
82-
assertTrue(adjustDestination.settings!!.setEnvironmentProduction)
83-
assertTrue(adjustDestination.settings!!.setEventBufferingEnabled)
84-
assertTrue(adjustDestination.settings!!.trackAttributionData)
85-
assertEquals(adjustDestination.settings!!.appToken, "xyz1234")
86-
assertNotNull(adjustDestination.settings!!.customEvents)
82+
assertTrue(setEnvironmentProduction)
83+
assertTrue(setEventBufferingEnabled)
84+
assertTrue(trackAttributionData)
85+
assertEquals(appToken, "xyz1234")
86+
assertNotNull(customEvents)
8787
}
8888
}
8989

@@ -194,7 +194,8 @@ class AdjustDestinationTests {
194194

195195
@Test
196196
fun `trackAttribution data sent correctly to analytics`() {
197-
val segmentAttributionChangedListener = AdjustDestination.AdjustSegmentAttributionChangedListener(mockedAnalytics)
197+
val segmentAttributionChangedListener =
198+
AdjustDestination.AdjustSegmentAttributionChangedListener(mockedAnalytics)
198199
val attributionData = AdjustAttribution().apply {
199200
network = "Adjust Network"
200201
campaign = "Adjust Campaign Name"
@@ -205,18 +206,20 @@ class AdjustDestinationTests {
205206
trackerName = "bar"
206207
}
207208
segmentAttributionChangedListener.onAttributionChanged(attributionData)
208-
verify { mockedAnalytics.track("Install Attributed", buildJsonObject {
209-
put("provider", "Adjust")
210-
put("trackerToken", "foo")
211-
put("trackerName", "bar")
212-
put("campaign", buildJsonObject {
213-
put("source", "Adjust Network")
214-
put("name", "Adjust Campaign Name")
215-
put("content", "Adjust Click Label")
216-
put("adCreative", "Adjust creative")
217-
put("adGroup", "Adjust Ad group")
209+
verify {
210+
mockedAnalytics.track("Install Attributed", buildJsonObject {
211+
put("provider", "Adjust")
212+
put("trackerToken", "foo")
213+
put("trackerName", "bar")
214+
put("campaign", buildJsonObject {
215+
put("source", "Adjust Network")
216+
put("name", "Adjust Campaign Name")
217+
put("content", "Adjust Click Label")
218+
put("adCreative", "Adjust creative")
219+
put("adGroup", "Adjust Ad group")
220+
})
218221
})
219-
}) }
222+
}
220223
}
221224

222225
@Test

0 commit comments

Comments
 (0)