-
-
Notifications
You must be signed in to change notification settings - Fork 611
Closed
Labels
Description
When writing tests with multiple asynchronous components (eg using OHHTTPStubs), it would be nice to do this:
waitUntil { clientDone, serverDone in
stub(alwaysIntercept()) { request in
serverDone() // server is satisfied that it received the request
return OHHTTPStubsResponse(data: someResponse, statusCode: 200, headers: nil)
}
MyObj.doWithCallback { _ in
clientDone() // client is satisfied that it received and handled the response
}
}At the moment, this doesn't seem to be possible at all, as nested waitUntils are explicitly caught: "Unexpected exception raised: Nested async expectations are not allowed to avoid creating flaky tests."
I'm enjoying using Nimble - it's much cleaner to write with than XCTest - but in this case, XCTest's expectations seem to be the better tool for the job.
maryamaffinityclick and elyasns