diff --git a/Tests/Tests/SDWebImageManagerTests.m b/Tests/Tests/SDWebImageManagerTests.m index 14c75aa0..9465fbf3 100644 --- a/Tests/Tests/SDWebImageManagerTests.m +++ b/Tests/Tests/SDWebImageManagerTests.m @@ -39,14 +39,24 @@ static int64_t kAsyncTestTimeout = 5; - (void)testThatDownloadInvokesCompletionBlockWithCorrectParamsAsync { NSURL *originalImageURL = [NSURL URLWithString:@"http://static2.dmcdn.net/static/video/656/177/44771656:jpeg_preview_small.jpg?20120509154705"]; - [[SDWebImageManager sharedManager] downloadImageWithURL:originalImageURL options:SDWebImageRefreshCached progress:^(NSInteger receivedSize, NSInteger expectedSize) { -// expect(receivedSize).to.beLessThanOrEqualTo(expectedSize); - } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { + [[SDWebImageManager sharedManager] downloadImageWithURL:originalImageURL options:SDWebImageRefreshCached progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { expect(image).toNot.beNil(); expect(error).to.beNil(); expect(originalImageURL).to.equal(imageURL); - NSLog(@"xxxx"); + XCAsyncSuccess(); + }]; + + XCAsyncFailAfter(kAsyncTestTimeout, @"Download image timed out"); +} + +- (void)testThatDownloadWithIncorrectURLInvokesCompletionBlockWithAnErrorAsync { + NSURL *originalImageURL = [NSURL URLWithString:@"http://static2.dmcdn.net/static/video/656/177/44771656:jpeg_preview_small.png"]; + + [[SDWebImageManager sharedManager] downloadImageWithURL:originalImageURL options:SDWebImageRefreshCached progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { + expect(image).to.beNil(); + expect(error).toNot.beNil(); + expect(originalImageURL).to.equal(imageURL); XCAsyncSuccess(); }];