Ver código fonte

Fix test for macOS

onevcat 5 anos atrás
pai
commit
c8975af59e
1 arquivos alterados com 4 adições e 2 exclusões
  1. 4 2
      Tests/KingfisherTests/RetryStrategyTests.swift

+ 4 - 2
Tests/KingfisherTests/RetryStrategyTests.swift

@@ -146,11 +146,13 @@ class RetryStrategyTests: XCTestCase {
         var blockCalled: [Bool] = []
         let source = Source.network(URL(string: "url")!)
         let retry = DelayRetryStrategy(maxRetryCount: 3, retryInterval: .seconds(0))
+
+        let task = URLSession.shared.dataTask(with: URL(string: "url")!)
+
         let context1 = RetryContext(
             source: source,
-            error: .requestError(reason: .taskCancelled(task: .init(task: .init()), token: .init()))
+            error: .requestError(reason: .taskCancelled(task: .init(task: task), token: .init()))
         )
-
         retry.retry(context: context1) { decision in
             guard case RetryDecision.stop = decision else {
                 XCTFail("The decision should be `stop` if user cancelled the task.")