Update the test cases

This commit is contained in:
DreamPiggy 2018-12-27 15:48:54 +08:00
parent b3a3a26a04
commit 2bfdac1f60
2 changed files with 3 additions and 3 deletions

View File

@ -195,13 +195,13 @@ static NSString *kTestImageKeyPNG = @"TestImageKey.png";
}
- (void)test20InitialCacheSize{
expect([[SDImageCache sharedImageCache] getSize]).to.equal(0);
expect([[SDImageCache sharedImageCache] totalDiskSize]).to.equal(0);
}
- (void)test21InitialDiskCount{
XCTestExpectation *expectation = [self expectationWithDescription:@"getDiskCount"];
[[SDImageCache sharedImageCache] storeImage:[self testJPEGImage] forKey:kTestImageKeyJPEG completion:^{
expect([[SDImageCache sharedImageCache] getDiskCount]).to.equal(1);
expect([[SDImageCache sharedImageCache] totalDiskCount]).to.equal(1);
[[SDImageCache sharedImageCache] removeImageForKey:kTestImageKeyJPEG withCompletion:^{
[expectation fulfill];
}];

View File

@ -77,7 +77,7 @@
}
- (void)removeExpiredData {
NSDate *expirationDate = [NSDate dateWithTimeIntervalSinceNow:-self.config.maxCacheAge];
NSDate *expirationDate = [NSDate dateWithTimeIntervalSinceNow:-self.config.maxDiskAge];
for (NSString *fileName in [self.fileManager enumeratorAtPath:self.cachePath]) {
NSString *filePath = [self.cachePath stringByAppendingPathComponent:fileName];
NSDate *modificationDate = [[self.fileManager attributesOfItemAtPath:filePath error:nil] objectForKey:NSFileModificationDate];