diff --git a/Tests/CrashesTests/CrashCollectionTests.swift b/Tests/CrashesTests/CrashCollectionTests.swift index 6d19e1d2e..3f67b94c4 100644 --- a/Tests/CrashesTests/CrashCollectionTests.swift +++ b/Tests/CrashesTests/CrashCollectionTests.swift @@ -103,7 +103,7 @@ class CrashCollectionTests: XCTestCase { let crashCollection = CrashCollection(crashReportSender: crashReportSender, crashCollectionStorage: store) let expectation = self.expectation(description: "Crash collection response") - + // Set up closures on our CrashCollection object crashCollection.start(process: {_ in return ["fake-crash-data".data(using: .utf8)!] // Not relevant to this test @@ -122,19 +122,19 @@ class CrashCollectionTests: XCTestCase { MXCrashDiagnostic() ]) ]) - + self.wait(for: [expectation], timeout: 3) - + XCTAssertEqual(store.object(forKey: CRCIDManager.crcidKey) as! String, "", "CRCID should not be present in the store after receiving a successful response") } - + func testCRCIDIsRetainedWhenServerErrorIsReceived() { let store = MockKeyValueStore() let crashReportSender = MockCrashReportSender(platform: .iOS, pixelEvents: nil) let crashCollection = CrashCollection(crashReportSender: crashReportSender, crashCollectionStorage: store) let expectation = self.expectation(description: "Crash collection response") - + // Set up closures on our CrashCollection object crashCollection.start(process: {_ in return ["fake-crash-data".data(using: .utf8)!] // Not relevant to this test @@ -154,9 +154,9 @@ class CrashCollectionTests: XCTestCase { MXCrashDiagnostic() ]) ]) - + self.wait(for: [expectation], timeout: 3) - + XCTAssertEqual(store.object(forKey: CRCIDManager.crcidKey) as? String, crcid) } } @@ -180,7 +180,7 @@ class MockPayload: MXDiagnosticPayload { } class MockCrashReportSender: CrashReportSending { - + let platform: CrashCollectionPlatform var responseCRCID: String? var responseStatusCode = 200 @@ -190,13 +190,13 @@ class MockCrashReportSender: CrashReportSending { required init(platform: CrashCollectionPlatform, pixelEvents: EventMapping?) { self.platform = platform } - + func send(_ crashReportData: Data, crcid: String?, completion: @escaping (_ result: Result, _ response: HTTPURLResponse?) -> Void) { var responseHeaderFields: [String: String] = [:] if let responseCRCID { responseHeaderFields[CrashReportSender.httpHeaderCRCID] = responseCRCID } - + guard let response = HTTPURLResponse(url: URL(string: "fakeURL")!, statusCode: responseStatusCode, httpVersion: nil,