-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(auth): add support for multiple auth instances (#445)
* feat(auth): add support for multiple auth instances * test: add tests for multiple auth client instances
- Loading branch information
Showing
14 changed files
with
254 additions
and
145 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
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,46 @@ | ||
// | ||
// AuthClientMultipleInstancesTests.swift | ||
// | ||
// | ||
// Created by Guilherme Souza on 05/07/24. | ||
// | ||
|
||
@testable import Auth | ||
import TestHelpers | ||
import XCTest | ||
|
||
final class AuthClientMultipleInstancesTests: XCTestCase { | ||
func testMultipleAuthClientInstances() { | ||
let url = URL(string: "http://localhost:54321/auth")! | ||
|
||
let client1Storage = InMemoryLocalStorage() | ||
let client2Storage = InMemoryLocalStorage() | ||
|
||
let client1 = AuthClient( | ||
configuration: AuthClient.Configuration( | ||
url: url, | ||
localStorage: client1Storage, | ||
logger: nil | ||
) | ||
) | ||
|
||
let client2 = AuthClient( | ||
configuration: AuthClient.Configuration( | ||
url: url, | ||
localStorage: client2Storage, | ||
logger: nil | ||
) | ||
) | ||
|
||
XCTAssertNotEqual(client1.clientID, client2.clientID) | ||
|
||
XCTAssertIdentical( | ||
Dependencies[client1.clientID].configuration.localStorage as? InMemoryLocalStorage, | ||
client1Storage | ||
) | ||
XCTAssertIdentical( | ||
Dependencies[client2.clientID].configuration.localStorage as? InMemoryLocalStorage, | ||
client2Storage | ||
) | ||
} | ||
} |
Oops, something went wrong.