From f14ba07740af2588d605a35615e6563dd43f635d Mon Sep 17 00:00:00 2001 From: Kiel Gillard Date: Fri, 17 Jan 2020 08:27:20 +1100 Subject: [PATCH] Fix test failures by cancelling operations with the queue. It seems operations no longer can cancel themselves. --- .../Feedly/FeedlyCheckpointOperationTests.swift | 2 +- .../AccountTests/Feedly/FeedlyLogoutOperationTests.swift | 2 +- .../Account/AccountTests/Feedly/FeedlyOperationTests.swift | 6 +++--- .../Feedly/FeedlyRefreshAccessTokenOperationTests.swift | 2 +- .../FeedlyUpdateAccountFeedsWithItemsOperationTests.swift | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Frameworks/Account/AccountTests/Feedly/FeedlyCheckpointOperationTests.swift b/Frameworks/Account/AccountTests/Feedly/FeedlyCheckpointOperationTests.swift index 7779c49eb..146bccf71 100644 --- a/Frameworks/Account/AccountTests/Feedly/FeedlyCheckpointOperationTests.swift +++ b/Frameworks/Account/AccountTests/Feedly/FeedlyCheckpointOperationTests.swift @@ -55,7 +55,7 @@ class FeedlyCheckpointOperationTests: XCTestCase { MainThreadOperationQueue.shared.addOperation(operation) - operation.cancel() + MainThreadOperationQueue.shared.cancelOperations([operation]) waitForExpectations(timeout: 1) } diff --git a/Frameworks/Account/AccountTests/Feedly/FeedlyLogoutOperationTests.swift b/Frameworks/Account/AccountTests/Feedly/FeedlyLogoutOperationTests.swift index 349eace59..bf80be311 100644 --- a/Frameworks/Account/AccountTests/Feedly/FeedlyLogoutOperationTests.swift +++ b/Frameworks/Account/AccountTests/Feedly/FeedlyLogoutOperationTests.swift @@ -75,7 +75,7 @@ class FeedlyLogoutOperationTests: XCTestCase { MainThreadOperationQueue.shared.addOperation(logout) - logout.cancel() + MainThreadOperationQueue.shared.cancelOperations([logout]) waitForExpectations(timeout: 1) diff --git a/Frameworks/Account/AccountTests/Feedly/FeedlyOperationTests.swift b/Frameworks/Account/AccountTests/Feedly/FeedlyOperationTests.swift index ce0a6e6d9..48282ae17 100644 --- a/Frameworks/Account/AccountTests/Feedly/FeedlyOperationTests.swift +++ b/Frameworks/Account/AccountTests/Feedly/FeedlyOperationTests.swift @@ -117,7 +117,7 @@ class FeedlyOperationTests: XCTestCase { MainThreadOperationQueue.shared.addOperation(testOperation) - testOperation.cancel() + MainThreadOperationQueue.shared.cancelOperations([testOperation]) waitForExpectations(timeout: 2) @@ -180,8 +180,8 @@ class FeedlyOperationTests: XCTestCase { MainThreadOperationQueue.shared.addOperation(testOperation) XCTAssertTrue(progress.numberRemaining == 1) - testOperation.cancel() - XCTAssertTrue(progress.numberRemaining == 1) + MainThreadOperationQueue.shared.cancelOperations([testOperation]) + XCTAssertTrue(progress.numberRemaining == 0) waitForExpectations(timeout: 2) diff --git a/Frameworks/Account/AccountTests/Feedly/FeedlyRefreshAccessTokenOperationTests.swift b/Frameworks/Account/AccountTests/Feedly/FeedlyRefreshAccessTokenOperationTests.swift index eb92754a8..245d34e69 100644 --- a/Frameworks/Account/AccountTests/Feedly/FeedlyRefreshAccessTokenOperationTests.swift +++ b/Frameworks/Account/AccountTests/Feedly/FeedlyRefreshAccessTokenOperationTests.swift @@ -63,7 +63,7 @@ class FeedlyRefreshAccessTokenOperationTests: XCTestCase { MainThreadOperationQueue.shared.addOperation(refresh) - refresh.cancel() + MainThreadOperationQueue.shared.cancelOperations([refresh]) waitForExpectations(timeout: 1) diff --git a/Frameworks/Account/AccountTests/Feedly/FeedlyUpdateAccountFeedsWithItemsOperationTests.swift b/Frameworks/Account/AccountTests/Feedly/FeedlyUpdateAccountFeedsWithItemsOperationTests.swift index 552a2bc12..304eea372 100644 --- a/Frameworks/Account/AccountTests/Feedly/FeedlyUpdateAccountFeedsWithItemsOperationTests.swift +++ b/Frameworks/Account/AccountTests/Feedly/FeedlyUpdateAccountFeedsWithItemsOperationTests.swift @@ -127,7 +127,7 @@ class FeedlyUpdateAccountFeedsWithItemsOperationTests: XCTestCase { MainThreadOperationQueue.shared.addOperation(update) - update.cancel() + MainThreadOperationQueue.shared.cancelOperations([update]) waitForExpectations(timeout: 2)