File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ @testable import Sentry
2+ import XCTest
3+
4+ class SentryPropagationContextTests : XCTestCase {
5+
6+ func testInitWithTraceIdSpanId( ) {
7+ let traceId = SentryId ( )
8+ let spanId = SpanId ( )
9+
10+ let context = SentryPropagationContext ( traceId: traceId, spanId: spanId)
11+
12+ XCTAssertEqual ( traceId, context. traceId)
13+ XCTAssertEqual ( spanId, context. spanId)
14+ }
15+
16+ func testTraceContextForEvent( ) {
17+ let traceId = SentryId ( )
18+ let spanId = SpanId ( )
19+
20+ let context = SentryPropagationContext ( traceId: traceId, spanId: spanId)
21+
22+ let traceContext = context. traceContextForEvent ( )
23+
24+ XCTAssertEqual ( traceContext. count, 2 )
25+ XCTAssertEqual ( traceContext [ " trace_id " ] , traceId. sentryIdString)
26+ XCTAssertEqual ( traceContext [ " span_id " ] , spanId. sentrySpanIdString)
27+ }
28+
29+ func testTraceHeader( ) {
30+ let traceId = SentryId ( )
31+ let spanId = SpanId ( )
32+
33+ let context = SentryPropagationContext ( traceId: traceId, spanId: spanId)
34+
35+ let traceHeader = context. traceHeader
36+
37+ XCTAssertNotNil ( traceHeader)
38+ XCTAssertEqual ( traceHeader. traceId, traceId)
39+ XCTAssertEqual ( traceHeader. spanId, spanId)
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments