Added error test
This commit is contained in:
parent
c1fae30d63
commit
e0b3de4357
|
@ -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();
|
||||
}];
|
||||
|
|
Loading…
Reference in New Issue