Skip to content

Commit

Permalink
Wait cache for prefetcher tests
Browse files Browse the repository at this point in the history
  • Loading branch information
onevcat committed Feb 10, 2019
1 parent 21998dc commit 46772d9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Tests/KingfisherTests/ImagePrefetcherTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,16 @@ class ImagePrefetcherTests: XCTestCase {
func testPrefetchMultiTimes() {
let exp = expectation(description: #function)
let group = DispatchGroup()

testURLs.forEach { stub($0, data: testImageData) }
for _ in 0..<10000 {
group.enter()
let prefetcher = ImagePrefetcher(resources: testURLs) { _, _, _ in
group.leave()
}
let prefetcher = ImagePrefetcher(
resources: testURLs,
options: [.waitForCache])
{ _, _, _ in group.leave() }
prefetcher.start()
}
group.notify(queue: .main) { exp.fulfill() }
waitForExpectations(timeout: 10, handler: nil)
waitForExpectations(timeout: 3, handler: nil)
}
}

0 comments on commit 46772d9

Please sign in to comment.