Skip to content

Commit 3c0c4e5

Browse files
committed
improve logger test
1 parent f9a9f1f commit 3c0c4e5

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

platform/jvm/capture/src/test/kotlin/io/bitdrift/capture/CaptureLoggerTest.kt

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -297,16 +297,7 @@ class CaptureLoggerTest {
297297
"bar" to "value_bar".toFieldValue(),
298298
"fields" to "passed_in".toFieldValue(),
299299
"foo" to "value_foo".toFieldValue(),
300-
) + getDefaultFields() +
301-
mapOf(
302-
"_app_version_code" to "0".toFieldValue(),
303-
"_architecture" to "armeabi-v7a".toFieldValue(),
304-
"_os_api_level" to "24".toFieldValue(),
305-
"app_id" to "io.bitdrift.capture".toFieldValue(),
306-
"app_version" to "?.?.?".toFieldValue(),
307-
"model" to "robolectric".toFieldValue(),
308-
"os_version" to "7.0".toFieldValue(),
309-
)
300+
) + getDefaultFields()
310301

311302
val sdkConfiguredLog = CaptureTestJniLibrary.nextUploadedLog()
312303
assertThat(sdkConfiguredLog.message).isEqualTo("SDKConfigured")
@@ -336,17 +327,7 @@ class CaptureLoggerTest {
336327
val expectedFields =
337328
mapOf(
338329
"fields" to "passed_in".toFieldValue(),
339-
) + getDefaultFields() +
340-
mapOf(
341-
"_app_version_code" to "0".toFieldValue(),
342-
"_architecture" to "armeabi-v7a".toFieldValue(),
343-
"_locale" to "ar".toFieldValue(),
344-
"_os_api_level" to "24".toFieldValue(),
345-
"app_id" to "io.bitdrift.capture".toFieldValue(),
346-
"app_version" to "?.?.?".toFieldValue(),
347-
"model" to "robolectric".toFieldValue(),
348-
"os_version" to "7.0".toFieldValue(),
349-
)
330+
) + getDefaultFields()
350331

351332
val sdkConfigured = CaptureTestJniLibrary.nextUploadedLog()
352333
assertThat(sdkConfigured.message).isEqualTo("SDKConfigured")
@@ -535,6 +516,16 @@ class CaptureLoggerTest {
535516
ProcessLifecycleOwner.get(),
536517
).invoke().toFieldValueMap() +
537518
NetworkAttributes(ContextHolder.APP_CONTEXT).invoke().toFieldValueMap()
538-
539-
private fun Map<String, String>.toFieldValueMap(): Map<String, FieldValue> = mapValues { (_, v) -> v.toFieldValue() }
519+
NetworkAttributes(ContextHolder.APP_CONTEXT).invoke().toFields() +
520+
mapOf(
521+
"_app_version_code" to "0".toFieldValue(),
522+
"_architecture" to "armeabi-v7a".toFieldValue(),
523+
"_locale" to "ar".toFieldValue(),
524+
"_os_api_level" to "24".toFieldValue(),
525+
"app_id" to "io.bitdrift.capture".toFieldValue(),
526+
"app_version" to "?.?.?".toFieldValue(),
527+
"model" to "robolectric".toFieldValue(),
528+
"os_version" to "7.0".toFieldValue(),
529+
)
530+
+ private fun Map<String, String>.toFieldValueMap(): Map<String, FieldValue> = mapValues { (_, v) -> v.toFieldValue() }
540531
}

0 commit comments

Comments
 (0)