Update the test case to check the return error domain and code

This commit is contained in:
DreamPiggy 2020-12-24 14:52:36 +08:00
parent 7313599a6c
commit d92c6cd945
1 changed files with 4 additions and 1 deletions

View File

@ -689,9 +689,12 @@
XCTestExpectation *expectation = [self expectationWithDescription:@"Downloader should callback when URLSessionTask running"];
NSURL *url = [NSURL URLWithString: @"https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/SDWebImage_logo.png"];
NSString *key = [SDWebImageManager.sharedManager cacheKeyForURL:url];
[SDImageCache.sharedImageCache clearWithCacheType:SDImageCacheTypeAll completion:^{
[SDImageCache.sharedImageCache removeImageForKey:key withCompletion:^{
SDWebImageCombinedOperation *operation = [SDWebImageManager.sharedManager loadImageWithURL:url options:0 progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
expect(error.domain).equal(SDWebImageErrorDomain);
expect(error.code).equal(SDWebImageErrorCancelled);
[expectation fulfill];
}];