From 0e5d4018087e01cfc3e4bf75ecf3747809c07c83 Mon Sep 17 00:00:00 2001 From: Pedro Lousada Date: Mon, 30 Jan 2023 17:50:01 +0000 Subject: [PATCH] Increase error count by 1 on the view update event following a crash --- Sources/Datadog/RUM/Integrations/CrashReportReceiver.swift | 2 +- .../Datadog/RUM/Integrations/CrashReportReceiverTests.swift | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Datadog/RUM/Integrations/CrashReportReceiver.swift b/Sources/Datadog/RUM/Integrations/CrashReportReceiver.swift index 2a06dfed37..01f03e4369 100644 --- a/Sources/Datadog/RUM/Integrations/CrashReportReceiver.swift +++ b/Sources/Datadog/RUM/Integrations/CrashReportReceiver.swift @@ -399,7 +399,7 @@ internal struct CrashReportReceiver: FeatureMessageReceiver { domComplete: original.view.domComplete, domContentLoaded: original.view.domContentLoaded, domInteractive: original.view.domInteractive, - error: original.view.error, + error: .init(count: original.view.error.count + 1), firstByte: nil, firstContentfulPaint: original.view.firstContentfulPaint, firstInputDelay: original.view.firstInputDelay, diff --git a/Tests/DatadogTests/Datadog/RUM/Integrations/CrashReportReceiverTests.swift b/Tests/DatadogTests/Datadog/RUM/Integrations/CrashReportReceiverTests.swift index 96251a27bc..70854e1f58 100644 --- a/Tests/DatadogTests/Datadog/RUM/Integrations/CrashReportReceiverTests.swift +++ b/Tests/DatadogTests/Datadog/RUM/Integrations/CrashReportReceiverTests.swift @@ -412,7 +412,7 @@ class CrashReportReceiverTests: XCTestCase { ) XCTAssertEqual(sendRUMViewEvent.view.name, lastRUMViewEvent.view.name) XCTAssertEqual(sendRUMViewEvent.view.url, lastRUMViewEvent.view.url) - XCTAssertEqual(sendRUMViewEvent.view.error.count, lastRUMViewEvent.view.error.count) + XCTAssertEqual(sendRUMViewEvent.view.error.count, lastRUMViewEvent.view.error.count + 1) XCTAssertEqual(sendRUMViewEvent.view.resource.count, lastRUMViewEvent.view.resource.count) XCTAssertEqual(sendRUMViewEvent.view.action.count, lastRUMViewEvent.view.action.count) XCTAssertEqual( @@ -616,7 +616,7 @@ class CrashReportReceiverTests: XCTestCase { XCTAssertTrue(sentRUMView.view.isActive == false, "The view must be marked inactive") XCTAssertEqual(sentRUMView.view.name, expectedViewName) XCTAssertEqual(sentRUMView.view.url, expectedViewURL) - XCTAssertEqual(sentRUMView.view.error.count, 0) + XCTAssertEqual(sentRUMView.view.error.count, 1, "The view must increase number of errors by 1") XCTAssertEqual(sentRUMView.view.resource.count, 0) XCTAssertEqual(sentRUMView.view.action.count, 0) XCTAssertEqual(sentRUMView.source, .init(rawValue: randomSource)) @@ -759,7 +759,7 @@ class CrashReportReceiverTests: XCTestCase { XCTAssertTrue(sentRUMView.view.isActive == false, "The view must be marked inactive") XCTAssertEqual(sentRUMView.view.name, expectedViewName) XCTAssertEqual(sentRUMView.view.url, expectedViewURL) - XCTAssertEqual(sentRUMView.view.error.count, 0) + XCTAssertEqual(sentRUMView.view.error.count, 1, "The view must increase number of errors by 1") XCTAssertEqual(sentRUMView.view.resource.count, 0) XCTAssertEqual(sentRUMView.view.action.count, 0) XCTAssertEqual(