Testing asynchronous code in Swift with XCTest expectations

Testing asynchronous callbacks in your Swift code? Try this:

Consider using OHHTTPStubs or just stubbing manually to make this run faster.

(Note that result is a simple Result enum like Rob Napier describes in Functional Wish Fulfillment.)