Fix build errors in Feedly test support
Two more cases of completion blocks taking Results, requiring a do/catch/Result.get() to unwrap. This commit deliberately leaves one build error for a more comprehensive fix, since it occurs in a helper function that will have broader fallout.
This commit is contained in:
parent
152b1f2b8a
commit
711aca3d1b
@ -220,12 +220,17 @@ class FeedlyTestSupport {
|
|||||||
func checkUnreadStatuses(in testAccount: Account, correspondToIdsInJSONPayload streamIds: [String: Any], testCase: XCTestCase) {
|
func checkUnreadStatuses(in testAccount: Account, correspondToIdsInJSONPayload streamIds: [String: Any], testCase: XCTestCase) {
|
||||||
let ids = Set(streamIds["ids"] as! [String])
|
let ids = Set(streamIds["ids"] as! [String])
|
||||||
let fetchIdsExpectation = testCase.expectation(description: "Fetch Article Ids")
|
let fetchIdsExpectation = testCase.expectation(description: "Fetch Article Ids")
|
||||||
testAccount.fetchUnreadArticleIDs { articleIds in
|
testAccount.fetchUnreadArticleIDs { articleIdsResult in
|
||||||
// Unread statuses can be paged from Feedly.
|
do {
|
||||||
// Instead of joining test data, the best we can do is
|
let articleIds = try articleIdsResult.get()
|
||||||
// make sure that these ids are marked as unread (a subset of the total).
|
// Unread statuses can be paged from Feedly.
|
||||||
XCTAssertTrue(ids.isSubset(of: articleIds), "Some articles in `ids` are not marked as unread.")
|
// Instead of joining test data, the best we can do is
|
||||||
fetchIdsExpectation.fulfill()
|
// make sure that these ids are marked as unread (a subset of the total).
|
||||||
|
XCTAssertTrue(ids.isSubset(of: articleIds), "Some articles in `ids` are not marked as unread.")
|
||||||
|
fetchIdsExpectation.fulfill()
|
||||||
|
} catch let e {
|
||||||
|
XCTFail("Error unwrapping article IDs: \(e)")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
testCase.wait(for: [fetchIdsExpectation], timeout: 2)
|
testCase.wait(for: [fetchIdsExpectation], timeout: 2)
|
||||||
}
|
}
|
||||||
@ -239,12 +244,17 @@ class FeedlyTestSupport {
|
|||||||
let items = stream["items"] as! [[String: Any]]
|
let items = stream["items"] as! [[String: Any]]
|
||||||
let ids = Set(items.map { $0["id"] as! String })
|
let ids = Set(items.map { $0["id"] as! String })
|
||||||
let fetchIdsExpectation = testCase.expectation(description: "Fetch Article Ids")
|
let fetchIdsExpectation = testCase.expectation(description: "Fetch Article Ids")
|
||||||
testAccount.fetchStarredArticleIDs { articleIds in
|
testAccount.fetchStarredArticleIDs { articleIdsResult in
|
||||||
// Starred articles can be paged from Feedly.
|
do {
|
||||||
// Instead of joining test data, the best we can do is
|
let articleIds = try articleIdsResult.get()
|
||||||
// make sure that these articles are marked as starred (a subset of the total).
|
// Starred articles can be paged from Feedly.
|
||||||
XCTAssertTrue(ids.isSubset(of: articleIds), "Some articles in `ids` are not marked as starred.")
|
// Instead of joining test data, the best we can do is
|
||||||
fetchIdsExpectation.fulfill()
|
// make sure that these articles are marked as starred (a subset of the total).
|
||||||
|
XCTAssertTrue(ids.isSubset(of: articleIds), "Some articles in `ids` are not marked as starred.")
|
||||||
|
fetchIdsExpectation.fulfill()
|
||||||
|
} catch let e {
|
||||||
|
XCTFail("Error unwrapping article IDs: \(e)")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
testCase.wait(for: [fetchIdsExpectation], timeout: 2)
|
testCase.wait(for: [fetchIdsExpectation], timeout: 2)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user