From 703848fcb42431663b18fb277c6142bd3a5942f6 Mon Sep 17 00:00:00 2001 From: Dhiogo Ramos Brustolin Date: Mon, 14 Aug 2023 12:28:32 +0200 Subject: [PATCH] Update SentryScopeSwiftTests.swift --- Tests/SentryTests/SentryScopeSwiftTests.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Tests/SentryTests/SentryScopeSwiftTests.swift b/Tests/SentryTests/SentryScopeSwiftTests.swift index 9b80644f418..1b7c4b91978 100644 --- a/Tests/SentryTests/SentryScopeSwiftTests.swift +++ b/Tests/SentryTests/SentryScopeSwiftTests.swift @@ -150,7 +150,8 @@ class SentryScopeSwiftTests: XCTestCase { func testApplyToEvent() { let actual = fixture.scope.applyTo(event: fixture.event, maxBreadcrumbs: 10) - + let actualContext = actual?.context as? [String: [String: String]] + XCTAssertEqual(fixture.tags, actual?.tags) XCTAssertEqual(fixture.extra, actual?.extra as? [String: String]) XCTAssertEqual(fixture.user, actual?.user) @@ -159,7 +160,8 @@ class SentryScopeSwiftTests: XCTestCase { XCTAssertEqual(fixture.fingerprint, actual?.fingerprint) XCTAssertEqual(fixture.level, actual?.level) XCTAssertEqual([fixture.breadcrumb], actual?.breadcrumbs) - XCTAssertEqual(fixture.context, actual?.context as? [String: [String: String]]) + XCTAssertEqual(fixture.context["c"], actualContext?["c"]) + XCTAssertNotNil(actualContext?["trace"]) } func testApplyToEvent_EventWithTags() { @@ -267,7 +269,8 @@ class SentryScopeSwiftTests: XCTestCase { } func testApplyToEvent_EventWithContext() { - let context = NSMutableDictionary(dictionary: ["my": ["extra": "context"]]) + let context = NSMutableDictionary(dictionary: ["my": ["extra": "context"], + "trace": fixture.scope.propagationContext.traceForEvent() ]) let event = fixture.event event.context = context as? [String: [String: String]] @@ -289,7 +292,7 @@ class SentryScopeSwiftTests: XCTestCase { func testApplyToEvent_EventWithContext_MergesContext() { let context = NSMutableDictionary(dictionary: [ - "first": ["a": "b", "c": "d"]]) + "first": ["a": "b", "c": "d"], "trace": fixture.scope.propagationContext.traceForEvent()]) let event = fixture.event event.context = context as? [String: [String: String]]