From b317a99594f834b6c1fa1800a8abe94f18bb02d5 Mon Sep 17 00:00:00 2001 From: Kiel Gillard Date: Fri, 15 Nov 2019 09:32:02 +1100 Subject: [PATCH] Fix failing Feedly tests. --- .../Account/AccountTests/Feedly/FeedlyOperationTests.swift | 1 + .../AccountTests/Feedly/FeedlySyncAllOperationTests.swift | 4 +++- .../Account/Feedly/Operations/FeedlySyncAllOperation.swift | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Frameworks/Account/AccountTests/Feedly/FeedlyOperationTests.swift b/Frameworks/Account/AccountTests/Feedly/FeedlyOperationTests.swift index dc880597d..12992d748 100644 --- a/Frameworks/Account/AccountTests/Feedly/FeedlyOperationTests.swift +++ b/Frameworks/Account/AccountTests/Feedly/FeedlyOperationTests.swift @@ -102,6 +102,7 @@ class FeedlyOperationTests: XCTestCase { func testOperationCancellationFlags() { let testOperation = TestOperation() testOperation.didCallMainExpectation = expectation(description: "Did Call Main") + testOperation.didCallMainExpectation?.isInverted = true let completionExpectation = expectation(description: "Operation Completed") testOperation.completionBlock = { diff --git a/Frameworks/Account/AccountTests/Feedly/FeedlySyncAllOperationTests.swift b/Frameworks/Account/AccountTests/Feedly/FeedlySyncAllOperationTests.swift index cd1a988d3..5c7869439 100644 --- a/Frameworks/Account/AccountTests/Feedly/FeedlySyncAllOperationTests.swift +++ b/Frameworks/Account/AccountTests/Feedly/FeedlySyncAllOperationTests.swift @@ -67,11 +67,13 @@ class FeedlySyncAllOperationTests: XCTestCase { } let syncCompletionExpectation = expectation(description: "Did Finish Sync") + syncCompletionExpectation.isInverted = true syncAll.syncCompletionHandler = { result in switch result { case .success: - XCTFail("Expected failure.") + XCTFail("Sync operation was cancelled, not successful.") case .failure: + XCTFail("Sync operation should cancel silently.") break } syncCompletionExpectation.fulfill() diff --git a/Frameworks/Account/Feedly/Operations/FeedlySyncAllOperation.swift b/Frameworks/Account/Feedly/Operations/FeedlySyncAllOperation.swift index b93031677..ff6a1df96 100644 --- a/Frameworks/Account/Feedly/Operations/FeedlySyncAllOperation.swift +++ b/Frameworks/Account/Feedly/Operations/FeedlySyncAllOperation.swift @@ -97,6 +97,9 @@ final class FeedlySyncAllOperation: FeedlyOperation { super.cancel() didFinish() + + // Operation should silently cancel. + syncCompletionHandler = nil } override func main() {