Skip to content

Commit 947e305

Browse files
Mark Pospeselmpospese
authored andcommitted
[Issue-7] increase timeout
CI/CD needs longer timeouts and this was the only test still using 1 second and not 5 seconds for its timeout… and it failed.
1 parent 97f268f commit 947e305

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Tests/YNetworkTests/NetworkManager/NetworkManagerUploadTests.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ final class NetworkManagerUploadTests: XCTestCase {
7171
let task = try XCTUnwrap(sut.submitBackgroundUpload(request) { _ in })
7272
task.cancel() // this will make it fail
7373

74-
wait(for: [expectation], timeout: 1.0)
74+
wait(for: [expectation], timeout: timeout)
7575

7676
XCTAssertNotNil(sut.receivedError)
7777
}
@@ -176,7 +176,9 @@ private final class NetworkManagerSpy: NetworkManager {
176176
if let httpResponse = task.response as? HTTPURLResponse {
177177
switch httpResponse.statusCode {
178178
case 200..<300:
179-
break
179+
if task.state == .canceling {
180+
error = NetworkSpyError.cancelled
181+
}
180182
case 401:
181183
error = NetworkError.unauthenticated
182184
default:
@@ -212,3 +214,7 @@ extension NetworkManagerSpy: URLSessionDataDelegate {
212214
self.receivedData = data
213215
}
214216
}
217+
218+
public enum NetworkSpyError: Error {
219+
case cancelled
220+
}

0 commit comments

Comments
 (0)