Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -360,13 +360,13 @@ class CheckoutWebViewTests: XCTestCase {
}

func testPreloadCacheExpiresAndStopsKeepAlive() {
let nearlyStaleCreatedAt = Date(timeIntervalSinceNow: -(5 * 60 - 0.1))
let nearlyStaleCreatedAt = Date(timeIntervalSinceNow: -(5 * 60 - 1))
CheckoutWebView.preload(checkout: EmbeddedCheckoutProtocol.url(for: url), createdAt: nearlyStaleCreatedAt)
XCTAssertTrue(CheckoutWebView.preloadCache.hasEntry())
XCTAssertTrue(CheckoutWebView.preloadCache.hasActiveKeepAlive())

let expired = expectation(description: "preload cache expired")
let deadline = Date(timeIntervalSinceNow: 2)
let deadline = Date(timeIntervalSinceNow: 3)
func pollForExpiry() {
if !CheckoutWebView.preloadCache.hasEntry(), !CheckoutWebView.preloadCache.hasActiveKeepAlive() {
expired.fulfill()
Expand All @@ -381,7 +381,7 @@ class CheckoutWebViewTests: XCTestCase {

pollForExpiry()

wait(for: [expired], timeout: 2)
wait(for: [expired], timeout: 3)
}

func testPreloadKeepAliveFailureInvalidatesCache() {
Expand Down
Loading