onevcat пре 7 година
родитељ
комит
899bd5fc91

+ 1 - 1
.ruby-version

@@ -1 +1 @@
-2.5.1
+2.4.5

+ 0 - 2
.travis.yml

@@ -17,8 +17,6 @@ matrix:
     env: LANE=test_ci SCHEME=Kingfisher-macOS SWIFT_VERSION=4.0
   - name: tvOS | Swift 4.0
     env: LANE=test_ci SCHEME=Kingfisher-tvOS SWIFT_VERSION=4.0
-  - name: lint
-    env: LANE=lint
 
 script:
   - bundle exec fastlane $LANE

+ 5 - 3
Tests/KingfisherTests/KingfisherManagerTests.swift

@@ -408,9 +408,11 @@ class KingfisherManagerTests: XCTestCase {
                 options: [.processor(p), .cacheOriginalImage, .originalCache(originalCache), .waitForCache])
             {
                 result in
-                let originalCached = originalCache.imageCachedType(forKey: url.cacheKey)
-                XCTAssertEqual(originalCached, .disk)
-                exp.fulfill()
+                delay(0.2) { // .waitForCache only works for regular cache, not for original cache.
+                    let originalCached = originalCache.imageCachedType(forKey: url.cacheKey)
+                    XCTAssertEqual(originalCached, .disk)
+                    exp.fulfill()
+                }
             }
         }
         waitForExpectations(timeout: 1, handler: nil)

+ 10 - 5
Tests/KingfisherTests/MemoryStorageTests.swift

@@ -163,20 +163,25 @@ class MemoryStorageTests: XCTestCase {
     func testExtendExpirationByAccessing() {
         let exp = expectation(description: #function)
 
-        let expiration = StorageExpiration.seconds(0.2)
+        let expiration = StorageExpiration.seconds(0.5)
         try! storage.store(value: 1, forKey: "1", expiration: expiration)
 
-        delay(0.1) {
-            // This should extend the expiration to (0.1 + 0.2) from initially created.
+        delay(0.2) {
+            // This should extend the expiration to (0.5 + 0.2) from initially created.
             let v = try! self.storage.value(forKey: "1")
             XCTAssertEqual(v, 1)
         }
 
-        delay(0.25) {
+        delay(0.6) {
+            // Accessing `isCached` does not extend expiration
             XCTAssertTrue(self.storage.isCached(forKey: "1"))
+        }
+        
+        delay(0.8) {
+            XCTAssertFalse(self.storage.isCached(forKey: "1"))
             exp.fulfill()
         }
-        waitForExpectations(timeout: 5, handler: nil)
+        waitForExpectations(timeout: 1, handler: nil)
     }
 
     func testAutoCleanExpiredMemory() {