|
@@ -148,33 +148,6 @@ class KingfisherManagerTests: XCTestCase {
|
|
|
waitForExpectations(timeout: 1, handler: nil)
|
|
waitForExpectations(timeout: 1, handler: nil)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- func testRetrieveImageWithoutWaitForCache() {
|
|
|
|
|
- let exp = expectation(description: #function)
|
|
|
|
|
- let url = testURLs[0]
|
|
|
|
|
- stub(url, data: testImageData)
|
|
|
|
|
-
|
|
|
|
|
- let manager = self.manager!
|
|
|
|
|
- manager.retrieveImage(with: url, options: []) { result in
|
|
|
|
|
- XCTAssertNotNil(result.value?.image)
|
|
|
|
|
- XCTAssertEqual(result.value!.cacheType, .none)
|
|
|
|
|
-
|
|
|
|
|
- var cacheType = manager.cache.imageCachedType(forKey: url.cacheKey)
|
|
|
|
|
- XCTAssertEqual(cacheType, .memory)
|
|
|
|
|
-
|
|
|
|
|
- manager.cache.clearMemoryCache()
|
|
|
|
|
- cacheType = manager.cache.imageCachedType(forKey: url.cacheKey)
|
|
|
|
|
- XCTAssertEqual(cacheType, .none)
|
|
|
|
|
-
|
|
|
|
|
- // Wait for disk cache finishes
|
|
|
|
|
- delay(0.1) {
|
|
|
|
|
- cacheType = manager.cache.imageCachedType(forKey: url.cacheKey)
|
|
|
|
|
- XCTAssertEqual(cacheType, .disk)
|
|
|
|
|
- exp.fulfill()
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- waitForExpectations(timeout: 1, handler: nil)
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
func testSuccessCompletionHandlerRunningOnMainQueueDefaultly() {
|
|
func testSuccessCompletionHandlerRunningOnMainQueueDefaultly() {
|
|
|
let progressExpectation = expectation(description: "progressBlock running on main queue")
|
|
let progressExpectation = expectation(description: "progressBlock running on main queue")
|
|
|
let completionExpectation = expectation(description: "completionHandler running on main queue")
|
|
let completionExpectation = expectation(description: "completionHandler running on main queue")
|