Skip to content

Instantly share code, notes, and snippets.

@jeksys
Created January 13, 2020 19:51
Show Gist options
  • Save jeksys/dad41eaa33395b0a9c9d7dc009ae8e0b to your computer and use it in GitHub Desktop.
Save jeksys/dad41eaa33395b0a9c9d7dc009ae8e0b to your computer and use it in GitHub Desktop.
class ImageScalerTests: XCTestCase {
func testScalingProducesSameAmountOfImages() {
let scaler = ImageScaler()
let originalImages = loadImages()
// Create an expectation
let expectation = self.expectation(description: "Scaling")
var scaledImages: [UIImage]?
scaler.scale(originalImages) {
scaledImages = $0
// Fullfil the expectation to let the test runner
// know that it's OK to proceed
expectation.fulfill()
}
// Wait for the expectation to be fullfilled, or time out
// after 5 seconds. This is where the test runner will pause.
waitForExpectations(timeout: 5, handler: nil)
XCTAssertEqual(scaledImages?.count, originalImages.count)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment