Skip to content

Commit

Permalink
test: Move MetricKit test data to folder (#3393)
Browse files Browse the repository at this point in the history
Move MetricKit test data to own folder in resources.
  • Loading branch information
philipphofmann authored Nov 9, 2023
1 parent e0f077c commit e89dc54
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ import MetricKit
final class SentryMXCallStackTreeTests: XCTestCase {

func testDecodeCallStackTree_PerThread() throws {
let contents = try contentsOfResource("metric-kit-callstack-per-thread")
let contents = try contentsOfResource("MetricKitCallstacks/per-thread")
let callStackTree = try SentryMXCallStackTree.from(data: contents)

try assertCallStackTree(callStackTree, callStackCount: 2)
}

func testDecodeCallStackTree_NotPerThread() throws {
let contents = try contentsOfResource("metric-kit-callstack-not-per-thread")
let contents = try contentsOfResource("MetricKitCallstacks/not-per-thread")
let callStackTree = try SentryMXCallStackTree.from(data: contents)

try assertCallStackTree(callStackTree, perThread: false, framesAmount: 14, threadAttributed: nil, subFrameCount: [2, 4, 0])
}

func testDecodeCallStackTree_UnknownFieldsPayload() throws {
let contents = try contentsOfResource("metric-kit-callstack-tree-unknown-fields")
let contents = try contentsOfResource("MetricKitCallstacks/tree-unknown-fields")
let callStackTree = try SentryMXCallStackTree.from(data: contents)

try assertCallStackTree(callStackTree)
}

func testDecodeCallStackTree_RealPayload() throws {
let contents = try contentsOfResource("metric-kit-callstack-tree-real")
let contents = try contentsOfResource("MetricKitCallstacks/tree-real")
let callStackTree = try SentryMXCallStackTree.from(data: contents)

XCTAssertNotNil(callStackTree)
Expand All @@ -45,7 +45,7 @@ final class SentryMXCallStackTreeTests: XCTestCase {
}

func testDecodeCallStackTree_GarbagePayload() throws {
let contents = try contentsOfResource("metric-kit-callstack-tree-garbage")
let contents = try contentsOfResource("MetricKitCallstacks/tree-garbage")
XCTAssertThrowsError(try SentryMXCallStackTree.from(data: contents))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ final class SentryMXManagerTests: XCTestCase {

let callStackTree = TestMXCallStackTree()
if withCallStackJSON {
callStackTree.overrides.jsonRepresentation = try contentsOfResource("metric-kit-callstack-per-thread")
callStackTree.overrides.jsonRepresentation = try contentsOfResource("MetricKitCallstacks/per-thread")
}

let crashDiagnostic = TestMXCrashDiagnostic()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ final class SentryMetricKitIntegrationTests: SentrySDKIntegrationTestsBase {
override func setUpWithError() throws {
try super.setUpWithError()

let contentsPerThread = try contentsOfResource("metric-kit-callstack-per-thread")
let contentsPerThread = try contentsOfResource("MetricKitCallstacks/per-thread")
callStackTreePerThread = try SentryMXCallStackTree.from(data: contentsPerThread)

let contentsNotPerThread = try contentsOfResource("metric-kit-callstack-not-per-thread")
let contentsNotPerThread = try contentsOfResource("MetricKitCallstacks/not-per-thread")
callStackTreeNotPerThread = try SentryMXCallStackTree.from(data: contentsNotPerThread)

// Starting from iOS 15 MetricKit payloads are delivered immediately, so
Expand Down

0 comments on commit e89dc54

Please sign in to comment.