fix test codes
This commit is contained in:
parent
9c6fa61af9
commit
4a80ea5370
|
@ -0,0 +1,3 @@
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
let timeoutInterval: TimeInterval = 20
|
|
@ -25,7 +25,7 @@ extension XCTestCase {
|
||||||
entity = response
|
entity = response
|
||||||
}
|
}
|
||||||
|
|
||||||
wait(for: [exp], timeout: 10)
|
waitForExpectations(timeout: timeoutInterval)
|
||||||
return entity
|
return entity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 }
|
||||||
|
|
|
@ -32,7 +32,7 @@ extension XCTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wait(for: [exp], timeout: 10)
|
waitForExpectations(timeout: timeoutInterval)
|
||||||
return entity
|
return entity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue