fix test codes

This commit is contained in:
417-72KI 2021-08-21 00:43:15 +09:00
parent 9c6fa61af9
commit 4a80ea5370
5 changed files with 8 additions and 5 deletions

View File

@ -0,0 +1,3 @@
import Foundation
let timeoutInterval: TimeInterval = 20

View File

@ -25,7 +25,7 @@ extension XCTestCase {
entity = response entity = response
} }
wait(for: [exp], timeout: 10) waitForExpectations(timeout: timeoutInterval)
return entity return entity
} }
} }

View File

@ -29,7 +29,7 @@ extension XCTestCase {
}, },
to: "https://localhost/upload" to: "https://localhost/upload"
).responseJSON { _ in exp.fulfill() } ).responseJSON { _ in exp.fulfill() }
wait(for: [exp], timeout: 10) waitForExpectations(timeout: timeoutInterval)
let response = try XCTUnwrap(request.response, file: file, line: line) let response = try XCTUnwrap(request.response, file: file, line: line)
XCTAssertEqual(response.statusCode, 200, file: file, line: line) XCTAssertEqual(response.statusCode, 200, file: file, line: line)
guard let data = request.data else { return nil } guard let data = request.data else { return nil }

View File

@ -32,7 +32,7 @@ extension XCTestCase {
} }
} }
wait(for: [exp], timeout: 10) waitForExpectations(timeout: timeoutInterval)
return entity return entity
} }
} }

View File

@ -25,7 +25,7 @@ extension XCTestCase {
entity = try? data.flatMap { try JSONDecoder().decode(TestEntity.self, from: $0) } entity = try? data.flatMap { try JSONDecoder().decode(TestEntity.self, from: $0) }
}.resume() }.resume()
wait(for: [exp], timeout: 10) waitForExpectations(timeout: timeoutInterval)
return entity return entity
} }
@ -52,7 +52,7 @@ extension XCTestCase {
entity = try? data.flatMap { try JSONDecoder().decode(TestEntity.self, from: $0) } entity = try? data.flatMap { try JSONDecoder().decode(TestEntity.self, from: $0) }
}.resume() }.resume()
wait(for: [exp], timeout: 10) waitForExpectations(timeout: timeoutInterval)
return entity return entity
} }
} }