|
|
@@ -467,23 +467,26 @@ class KingfisherManagerTests: XCTestCase {
|
|
|
|
|
|
let url = URL(string: URLString)!
|
|
|
|
|
|
- manager.retrieveImage(with: url, options: [.fromMemoryCacheOrRefresh], progressBlock: nil) {
|
|
|
- image, _, type, _ in
|
|
|
- // Can download and cache normally
|
|
|
- XCTAssertNotNil(image)
|
|
|
- XCTAssertEqual(type, .none)
|
|
|
-
|
|
|
- // Can still be got from memory even when disk cache cleared.
|
|
|
- self.manager.cache.clearDiskCache {
|
|
|
- self.manager.retrieveImage(with: url, options: [.fromMemoryCacheOrRefresh], progressBlock: nil) {
|
|
|
- image, _, type, _ in
|
|
|
- XCTAssertNotNil(image)
|
|
|
- XCTAssertEqual(type, .memory)
|
|
|
-
|
|
|
- expectation.fulfill()
|
|
|
+ delay(0.1) { // Wait for disk cache cleaning
|
|
|
+ self.manager.retrieveImage(with: url, options: [.fromMemoryCacheOrRefresh], progressBlock: nil) {
|
|
|
+ image, _, type, _ in
|
|
|
+ // Can download and cache normally
|
|
|
+ XCTAssertNotNil(image)
|
|
|
+ XCTAssertEqual(type, .none)
|
|
|
+
|
|
|
+ // Can still be got from memory even when disk cache cleared.
|
|
|
+ self.manager.cache.clearDiskCache {
|
|
|
+ self.manager.retrieveImage(with: url, options: [.fromMemoryCacheOrRefresh], progressBlock: nil) {
|
|
|
+ image, _, type, _ in
|
|
|
+ XCTAssertNotNil(image)
|
|
|
+ XCTAssertEqual(type, .memory)
|
|
|
+
|
|
|
+ expectation.fulfill()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
waitForExpectations(timeout: 5, handler: nil)
|
|
|
}
|
|
|
|