Skip to content

Commit

Permalink
Android: added unit tests for synthetics attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-saia-datadog committed Oct 7, 2024
1 parent 16e0b34 commit cd86b6b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ class DdSdkImplementation(
return
}

val core = DatadogSDKWrapperStorage.getSdkCore()
val monitor = GlobalRumMonitor.get(core)
monitor._getInternal()?.setSyntheticsAttribute(
datadog.getRumMonitor()._getInternal()?.setSyntheticsAttribute(
DdSdkSynthetics.testId,
DdSdkSynthetics.resultId
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2293,6 +2293,23 @@ internal class DdSdkTest {
.hasFieldEqualTo("customEndpointUrl", customTraceEndpoint)
}

@Test
fun `𝕄 initialize native SDK π•Ž initialize() {synthethics attributes}`() {
// Given
fakeConfiguration = fakeConfiguration.copy(nativeCrashReportEnabled = false, site = null)
DdSdkSynthetics.testId = "unit-test-test-id"
DdSdkSynthetics.resultId = "unit-test-result-id"

// When
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)

// Then
verify(mockRumInternalProxy).setSyntheticsAttribute(
"unit-test-test-id",
"unit-test-result-id"
)
}

@Test
fun `𝕄 clear all data π•Ž clearAllData()`() {
// When
Expand Down

0 comments on commit cd86b6b

Please sign in to comment.