Add missing expectations to send statuses tests
f82be27666
flipped around calls to `selectPendingCount(_:)` so that it
respected the new async nature of the method; however, it neglected to
add enough XCTestExpectations to keep the test methods running through
the callbacks. Add those here.
This commit is contained in:
parent
e4c84bc501
commit
5ac18b14a7
|
@ -75,14 +75,17 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
|
||||||
|
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
|
let selectPendingCountExpectation = expectation(description: "Did Select Pending Count")
|
||||||
container.database.selectPendingCount { result in
|
container.database.selectPendingCount { result in
|
||||||
do {
|
do {
|
||||||
let statusCount = try result.get()
|
let statusCount = try result.get()
|
||||||
XCTAssertEqual(statusCount, 0)
|
XCTAssertEqual(statusCount, 0)
|
||||||
|
selectPendingCountExpectation.fulfill()
|
||||||
} catch let e {
|
} catch let e {
|
||||||
XCTFail("Error unwrapping database result: \(e)")
|
XCTFail("Error unwrapping database result: \(e)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSendUnreadFailure() {
|
func testSendUnreadFailure() {
|
||||||
|
@ -115,14 +118,17 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
|
||||||
|
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
|
let selectPendingCountExpectation = expectation(description: "Did Select Pending Count")
|
||||||
container.database.selectPendingCount { result in
|
container.database.selectPendingCount { result in
|
||||||
do {
|
do {
|
||||||
let statusCount = try result.get()
|
let statusCount = try result.get()
|
||||||
XCTAssertEqual(statusCount, statuses.count)
|
XCTAssertEqual(statusCount, statuses.count)
|
||||||
|
selectPendingCountExpectation.fulfill()
|
||||||
} catch let e {
|
} catch let e {
|
||||||
XCTFail("Error unwrapping database result: \(e)")
|
XCTFail("Error unwrapping database result: \(e)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSendReadSuccess() {
|
func testSendReadSuccess() {
|
||||||
|
@ -155,14 +161,17 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
|
||||||
|
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
|
let selectPendingCountExpectation = expectation(description: "Did Select Pending Count")
|
||||||
container.database.selectPendingCount { result in
|
container.database.selectPendingCount { result in
|
||||||
do {
|
do {
|
||||||
let statusCount = try result.get()
|
let statusCount = try result.get()
|
||||||
XCTAssertEqual(statusCount, 0)
|
XCTAssertEqual(statusCount, 0)
|
||||||
|
selectPendingCountExpectation.fulfill()
|
||||||
} catch let e {
|
} catch let e {
|
||||||
XCTFail("Error unwrapping database result: \(e)")
|
XCTFail("Error unwrapping database result: \(e)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSendReadFailure() {
|
func testSendReadFailure() {
|
||||||
|
@ -195,14 +204,17 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
|
||||||
|
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
|
let selectPendingCountExpectation = expectation(description: "Did Select Pending Count")
|
||||||
container.database.selectPendingCount { result in
|
container.database.selectPendingCount { result in
|
||||||
do {
|
do {
|
||||||
let statusCount = try result.get()
|
let statusCount = try result.get()
|
||||||
XCTAssertEqual(statusCount, statuses.count)
|
XCTAssertEqual(statusCount, statuses.count)
|
||||||
|
selectPendingCountExpectation.fulfill()
|
||||||
} catch let e {
|
} catch let e {
|
||||||
XCTFail("Error unwrapping database result: \(e)")
|
XCTFail("Error unwrapping database result: \(e)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSendStarredSuccess() {
|
func testSendStarredSuccess() {
|
||||||
|
@ -235,14 +247,17 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
|
||||||
|
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
|
let selectPendingCountExpectation = expectation(description: "Did Select Pending Count")
|
||||||
container.database.selectPendingCount { result in
|
container.database.selectPendingCount { result in
|
||||||
do {
|
do {
|
||||||
let statusCount = try result.get()
|
let statusCount = try result.get()
|
||||||
XCTAssertEqual(statusCount, 0)
|
XCTAssertEqual(statusCount, 0)
|
||||||
|
selectPendingCountExpectation.fulfill()
|
||||||
} catch let e {
|
} catch let e {
|
||||||
XCTFail("Error unwrapping database result: \(e)")
|
XCTFail("Error unwrapping database result: \(e)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSendStarredFailure() {
|
func testSendStarredFailure() {
|
||||||
|
@ -275,14 +290,17 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
|
||||||
|
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
|
let selectPendingCountExpectation = expectation(description: "Did Select Pending Count")
|
||||||
container.database.selectPendingCount { result in
|
container.database.selectPendingCount { result in
|
||||||
do {
|
do {
|
||||||
let statusCount = try result.get()
|
let statusCount = try result.get()
|
||||||
XCTAssertEqual(statusCount, statuses.count)
|
XCTAssertEqual(statusCount, statuses.count)
|
||||||
|
selectPendingCountExpectation.fulfill()
|
||||||
} catch let e {
|
} catch let e {
|
||||||
XCTFail("Error unwrapping database result: \(e)")
|
XCTFail("Error unwrapping database result: \(e)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSendUnstarredSuccess() {
|
func testSendUnstarredSuccess() {
|
||||||
|
@ -315,14 +333,17 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
|
||||||
|
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
|
let selectPendingCountExpectation = expectation(description: "Did Select Pending Count")
|
||||||
container.database.selectPendingCount { result in
|
container.database.selectPendingCount { result in
|
||||||
do {
|
do {
|
||||||
let statusCount = try result.get()
|
let statusCount = try result.get()
|
||||||
XCTAssertEqual(statusCount, 0)
|
XCTAssertEqual(statusCount, 0)
|
||||||
|
selectPendingCountExpectation.fulfill()
|
||||||
} catch let e {
|
} catch let e {
|
||||||
XCTFail("Error unwrapping database result: \(e)")
|
XCTFail("Error unwrapping database result: \(e)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSendUnstarredFailure() {
|
func testSendUnstarredFailure() {
|
||||||
|
@ -355,14 +376,17 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
|
||||||
|
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
|
let selectPendingCountExpectation = expectation(description: "Did Select Pending Count")
|
||||||
container.database.selectPendingCount { result in
|
container.database.selectPendingCount { result in
|
||||||
do {
|
do {
|
||||||
let expectedCount = try result.get()
|
let expectedCount = try result.get()
|
||||||
XCTAssertEqual(expectedCount, statuses.count)
|
XCTAssertEqual(expectedCount, statuses.count)
|
||||||
|
selectPendingCountExpectation.fulfill()
|
||||||
} catch let e {
|
} catch let e {
|
||||||
XCTFail("Error unwrapping database result: \(e)")
|
XCTFail("Error unwrapping database result: \(e)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSendAllSuccess() {
|
func testSendAllSuccess() {
|
||||||
|
@ -412,14 +436,17 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
|
||||||
|
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
|
let selectPendingCountExpectation = expectation(description: "Did Select Pending Count")
|
||||||
container.database.selectPendingCount { result in
|
container.database.selectPendingCount { result in
|
||||||
do {
|
do {
|
||||||
let statusCount = try result.get()
|
let statusCount = try result.get()
|
||||||
XCTAssertEqual(statusCount, 0)
|
XCTAssertEqual(statusCount, 0)
|
||||||
|
selectPendingCountExpectation.fulfill()
|
||||||
} catch let e {
|
} catch let e {
|
||||||
XCTFail("Error unwrapping database result: \(e)")
|
XCTFail("Error unwrapping database result: \(e)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSendAllFailure() {
|
func testSendAllFailure() {
|
||||||
|
@ -470,13 +497,16 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
|
||||||
|
|
||||||
waitForExpectations(timeout: 2)
|
waitForExpectations(timeout: 2)
|
||||||
|
|
||||||
|
let selectPendingCountExpectation = expectation(description: "Did Select Pending Count")
|
||||||
container.database.selectPendingCount { result in
|
container.database.selectPendingCount { result in
|
||||||
do {
|
do {
|
||||||
let statusCount = try result.get()
|
let statusCount = try result.get()
|
||||||
XCTAssertEqual(statusCount, statuses.count)
|
XCTAssertEqual(statusCount, statuses.count)
|
||||||
|
selectPendingCountExpectation.fulfill()
|
||||||
} catch let e {
|
} catch let e {
|
||||||
XCTFail("Error unwrapping database result: \(e)")
|
XCTFail("Error unwrapping database result: \(e)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
waitForExpectations(timeout: 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue