-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7fe0bd9
commit 737a3a9
Showing
5 changed files
with
81 additions
and
6 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
29 changes: 29 additions & 0 deletions
29
StripeConnect/StripeConnectTests/EmbeddedComponentManagerTests.swift
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,29 @@ | ||
// | ||
// EmbeddedComponentManagerTests.swift | ||
// StripeConnectTests | ||
// | ||
// Created by Mel Ludowise on 9/24/24. | ||
// | ||
|
||
@_spi(PrivateBetaConnect) @testable import StripeConnect | ||
import XCTest | ||
|
||
class EmbeddedComponentManagerTests: XCTestCase { | ||
var componentManager = EmbeddedComponentManager { | ||
return nil | ||
} | ||
|
||
@MainActor | ||
func testLogout() async throws { | ||
// Expect a logout proxy | ||
let logoutProxy = try XCTUnwrap(componentManager.childWebViews.allObjects.first) | ||
XCTAssertEqual(componentManager.childWebViews.count, 1) | ||
XCTAssertEqual(logoutProxy.componentType, .logoutProxy) | ||
|
||
let expectation = try logoutProxy.expectationForMessageReceived(sender: LogoutSender()) | ||
|
||
componentManager.logout() | ||
|
||
await fulfillment(of: [expectation], timeout: TestHelpers.defaultTimeout) | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
StripeConnect/StripeConnectTests/Internal/Webview/MessageSenders/LogoutSenderTests.swift
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,24 @@ | ||
// | ||
// LogoutSenderTests.swift | ||
// StripeConnectTests | ||
// | ||
// Created by Mel Ludowise on 9/24/24. | ||
// | ||
|
||
@testable import StripeConnect | ||
import XCTest | ||
|
||
class LogoutSenderTests: ScriptWebTestBase { | ||
func testSendMessage() throws { | ||
try validateMessageSent(sender: LogoutSender()) | ||
} | ||
|
||
func testSenderSignature() { | ||
XCTAssertEqual( | ||
LogoutSender().javascriptMessage, | ||
""" | ||
window.logout({}); | ||
""" | ||
) | ||
} | ||
} |