diff --git a/packages/core/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt b/packages/core/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt index 7220c6c76..8f5020080 100644 --- a/packages/core/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +++ b/packages/core/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt @@ -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 ) diff --git a/packages/core/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt b/packages/core/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt index 46bffe029..071b9ee7c 100644 --- a/packages/core/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +++ b/packages/core/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt @@ -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