-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add checkout session active * Reset checkoutSessionId when Headless cleans up * add test for headless cleanup
- Loading branch information
Showing
4 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Niall Quinn on 06/08/24. | ||
// | ||
|
||
import XCTest | ||
@testable import PrimerSDK | ||
|
||
final class CheckoutSessionTests: XCTestCase { | ||
func test_headless_cleanup() { | ||
XCTAssertFalse(Primer.shared.checkoutSessionIsActive()) | ||
|
||
let expectation = self.expectation(description: "Wait for headless load") | ||
|
||
PrimerHeadlessUniversalCheckout.current.start(withClientToken: "") { paymentMethods, err in | ||
XCTAssertTrue(Primer.shared.checkoutSessionIsActive()) | ||
expectation.fulfill() | ||
} | ||
|
||
waitForExpectations(timeout: 30) | ||
PrimerHeadlessUniversalCheckout.current.cleanUp() | ||
XCTAssertFalse(Primer.shared.checkoutSessionIsActive()) | ||
} | ||
} |