mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Fix errors in Feedly set starred operations tests
More of the same: completion blocks which take Results need do/catch/Result.get().
This commit is contained in:
@@ -49,10 +49,15 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
|
|||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
||||||
account.fetchStarredArticleIDs { accountArticlesIDs in
|
account.fetchStarredArticleIDs { accountArticlesIDsResult in
|
||||||
XCTAssertTrue(accountArticlesIDs.isEmpty)
|
do {
|
||||||
XCTAssertEqual(accountArticlesIDs, testIds)
|
let accountArticlesIDs = try accountArticlesIDsResult.get()
|
||||||
fetchIdsExpectation.fulfill()
|
XCTAssertTrue(accountArticlesIDs.isEmpty)
|
||||||
|
XCTAssertEqual(accountArticlesIDs, testIds)
|
||||||
|
fetchIdsExpectation.fulfill()
|
||||||
|
} catch let e {
|
||||||
|
XCTFail("Error checking articles IDs: \(e)")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
@@ -73,9 +78,14 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
|
|||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
||||||
account.fetchStarredArticleIDs { accountArticlesIDs in
|
account.fetchStarredArticleIDs { accountArticlesIDsResult in
|
||||||
XCTAssertEqual(accountArticlesIDs.count, testIds.count)
|
do {
|
||||||
fetchIdsExpectation.fulfill()
|
let accountArticlesIDs = try accountArticlesIDsResult.get()
|
||||||
|
XCTAssertEqual(accountArticlesIDs.count, testIds.count)
|
||||||
|
fetchIdsExpectation.fulfill()
|
||||||
|
} catch let e {
|
||||||
|
XCTFail("Error checking articles IDs: \(e)")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
@@ -96,9 +106,14 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
|
|||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
||||||
account.fetchStarredArticleIDs { accountArticlesIDs in
|
account.fetchStarredArticleIDs { accountArticlesIDsResult in
|
||||||
XCTAssertEqual(accountArticlesIDs.count, testIds.count)
|
do {
|
||||||
fetchIdsExpectation.fulfill()
|
let accountArticlesIDs = try accountArticlesIDsResult.get()
|
||||||
|
XCTAssertEqual(accountArticlesIDs.count, testIds.count)
|
||||||
|
fetchIdsExpectation.fulfill()
|
||||||
|
} catch let e {
|
||||||
|
XCTFail("Error checking articles IDs: \(e)")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
@@ -134,9 +149,14 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
|
|||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
||||||
account.fetchStarredArticleIDs { remainingAccountArticlesIDs in
|
account.fetchStarredArticleIDs { remainingAccountArticlesIDsResult in
|
||||||
XCTAssertEqual(remainingAccountArticlesIDs, remainingStarredIds)
|
do {
|
||||||
fetchIdsExpectation.fulfill()
|
let remainingAccountArticlesIDs = try remainingAccountArticlesIDsResult.get()
|
||||||
|
XCTAssertEqual(remainingAccountArticlesIDs, remainingStarredIds)
|
||||||
|
fetchIdsExpectation.fulfill()
|
||||||
|
} catch let e {
|
||||||
|
XCTFail("Error checking articles IDs: \(e)")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
@@ -172,9 +192,14 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
|
|||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
||||||
account.fetchStarredArticleIDs { remainingAccountArticlesIDs in
|
account.fetchStarredArticleIDs { remainingAccountArticlesIDsResult in
|
||||||
XCTAssertEqual(remainingAccountArticlesIDs, remainingStarredIds)
|
do {
|
||||||
fetchIdsExpectation.fulfill()
|
let remainingAccountArticlesIDs = try remainingAccountArticlesIDsResult.get()
|
||||||
|
XCTAssertEqual(remainingAccountArticlesIDs, remainingStarredIds)
|
||||||
|
fetchIdsExpectation.fulfill()
|
||||||
|
} catch let e {
|
||||||
|
XCTFail("Error checking articles IDs: \(e)")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
@@ -221,15 +246,20 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
|
|||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
||||||
account.fetchStarredArticleIDs { accountArticlesIDs in
|
account.fetchStarredArticleIDs { accountArticlesIDsResult in
|
||||||
XCTAssertEqual(accountArticlesIDs, remainingStarredIds)
|
do {
|
||||||
|
let accountArticlesIDs = try accountArticlesIDsResult.get()
|
||||||
let idsOfStarredArticles = Set(self.account
|
XCTAssertEqual(accountArticlesIDs, remainingStarredIds)
|
||||||
.fetchArticles(.articleIDs(remainingStarredIds))
|
|
||||||
.filter { $0.status.boolStatus(forKey: .starred) == true }
|
let idsOfStarredArticles = Set(try self.account
|
||||||
.map { $0.articleID })
|
.fetchArticles(.articleIDs(remainingStarredIds))
|
||||||
|
.filter { $0.status.boolStatus(forKey: .starred) == true }
|
||||||
XCTAssertEqual(idsOfStarredArticles, remainingStarredIds)
|
.map { $0.articleID })
|
||||||
|
|
||||||
|
XCTAssertEqual(idsOfStarredArticles, remainingStarredIds)
|
||||||
|
} catch let e {
|
||||||
|
XCTFail("Error checking articles IDs: \(e)")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
@@ -274,15 +304,20 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
|
|||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
||||||
account.fetchStarredArticleIDs { accountArticlesIDs in
|
account.fetchStarredArticleIDs { accountArticlesIDsResult in
|
||||||
XCTAssertEqual(accountArticlesIDs, remainingStarredIds)
|
do {
|
||||||
|
let accountArticlesIDs = try accountArticlesIDsResult.get()
|
||||||
let idsOfStarredArticles = Set(self.account
|
XCTAssertEqual(accountArticlesIDs, remainingStarredIds)
|
||||||
.fetchArticles(.articleIDs(remainingStarredIds))
|
|
||||||
.filter { $0.status.boolStatus(forKey: .starred) == true }
|
let idsOfStarredArticles = Set(try self.account
|
||||||
.map { $0.articleID })
|
.fetchArticles(.articleIDs(remainingStarredIds))
|
||||||
|
.filter { $0.status.boolStatus(forKey: .starred) == true }
|
||||||
XCTAssertEqual(idsOfStarredArticles, remainingStarredIds)
|
.map { $0.articleID })
|
||||||
|
|
||||||
|
XCTAssertEqual(idsOfStarredArticles, remainingStarredIds)
|
||||||
|
} catch let e {
|
||||||
|
XCTFail("Error checking articles IDs: \(e)")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
@@ -321,16 +356,21 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
|
|||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
||||||
account.fetchStarredArticleIDs { accountArticlesIDs in
|
account.fetchStarredArticleIDs { accountArticlesIDsResult in
|
||||||
XCTAssertEqual(accountArticlesIDs, remainingStarredIds)
|
do {
|
||||||
|
let accountArticlesIDs = try accountArticlesIDsResult.get()
|
||||||
let idsOfStarredArticles = Set(self.account
|
XCTAssertEqual(accountArticlesIDs, remainingStarredIds)
|
||||||
.fetchArticles(.articleIDs(remainingStarredIds))
|
|
||||||
.filter { $0.status.boolStatus(forKey: .starred) == true }
|
let idsOfStarredArticles = Set(try self.account
|
||||||
.map { $0.articleID })
|
.fetchArticles(.articleIDs(remainingStarredIds))
|
||||||
|
.filter { $0.status.boolStatus(forKey: .starred) == true }
|
||||||
XCTAssertEqual(idsOfStarredArticles, remainingStarredIds)
|
.map { $0.articleID })
|
||||||
fetchIdsExpectation.fulfill()
|
|
||||||
|
XCTAssertEqual(idsOfStarredArticles, remainingStarredIds)
|
||||||
|
fetchIdsExpectation.fulfill()
|
||||||
|
} catch let e {
|
||||||
|
XCTFail("Error checking articles IDs: \(e)")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
@@ -368,16 +408,21 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
|
|||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
||||||
account.fetchStarredArticleIDs { accountArticlesIDs in
|
account.fetchStarredArticleIDs { accountArticlesIDsResult in
|
||||||
XCTAssertEqual(accountArticlesIDs, remainingStarredIds)
|
do {
|
||||||
|
let accountArticlesIDs = try accountArticlesIDsResult.get()
|
||||||
let idsOfStarredArticles = Set(self.account
|
XCTAssertEqual(accountArticlesIDs, remainingStarredIds)
|
||||||
.fetchArticles(.articleIDs(remainingStarredIds))
|
|
||||||
.filter { $0.status.boolStatus(forKey: .starred) == true }
|
let idsOfStarredArticles = Set(try self.account
|
||||||
.map { $0.articleID })
|
.fetchArticles(.articleIDs(remainingStarredIds))
|
||||||
|
.filter { $0.status.boolStatus(forKey: .starred) == true }
|
||||||
XCTAssertEqual(idsOfStarredArticles, remainingStarredIds)
|
.map { $0.articleID })
|
||||||
fetchIdsExpectation.fulfill()
|
|
||||||
|
XCTAssertEqual(idsOfStarredArticles, remainingStarredIds)
|
||||||
|
fetchIdsExpectation.fulfill()
|
||||||
|
} catch let e {
|
||||||
|
XCTFail("Error checking articles IDs: \(e)")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
@@ -418,19 +463,24 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
|
|||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
let fetchIdsExpectation = expectation(description: "Fetch Article Ids")
|
||||||
account.fetchStarredArticleIDs { accountArticlesIDs in
|
account.fetchStarredArticleIDs { accountArticlesIDsResult in
|
||||||
XCTAssertEqual(accountArticlesIDs, remainingStarredIds)
|
do {
|
||||||
|
let accountArticlesIDs = try accountArticlesIDsResult.get()
|
||||||
let someTestItems = Set(someItemsAndFeeds.flatMap { $0.value })
|
XCTAssertEqual(accountArticlesIDs, remainingStarredIds)
|
||||||
let someRemainingStarredIdsOfIngestedArticles = Set(someTestItems.compactMap { $0.syncServiceID })
|
|
||||||
let idsOfStarredArticles = Set(self.account
|
let someTestItems = Set(someItemsAndFeeds.flatMap { $0.value })
|
||||||
.fetchArticles(.articleIDs(someRemainingStarredIdsOfIngestedArticles))
|
let someRemainingStarredIdsOfIngestedArticles = Set(someTestItems.compactMap { $0.syncServiceID })
|
||||||
.filter { $0.status.boolStatus(forKey: .starred) == true }
|
let idsOfStarredArticles = Set(try self.account
|
||||||
.map { $0.articleID })
|
.fetchArticles(.articleIDs(someRemainingStarredIdsOfIngestedArticles))
|
||||||
|
.filter { $0.status.boolStatus(forKey: .starred) == true }
|
||||||
XCTAssertEqual(idsOfStarredArticles, someRemainingStarredIdsOfIngestedArticles)
|
.map { $0.articleID })
|
||||||
|
|
||||||
fetchIdsExpectation.fulfill()
|
XCTAssertEqual(idsOfStarredArticles, someRemainingStarredIdsOfIngestedArticles)
|
||||||
|
|
||||||
|
fetchIdsExpectation.fulfill()
|
||||||
|
} catch let e {
|
||||||
|
XCTFail("Error checking articles IDs: \(e)")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user