@@ -410,7 +410,8 @@ final class AuthClientTests: XCTestCase {
410410 {
411411 " url " : " \( url) "
412412 }
413- """ . utf8)
413+ """ . utf8
414+ )
414415 ]
415416 )
416417 . snapshotRequest {
@@ -454,7 +455,8 @@ final class AuthClientTests: XCTestCase {
454455 {
455456 " url " : " \( url) "
456457 }
457- """ . utf8)
458+ """ . utf8
459+ )
458460 ]
459461 )
460462 . snapshotRequest {
@@ -805,7 +807,8 @@ final class AuthClientTests: XCTestCase {
805807 func testGetOAuthSignInURL( ) async throws {
806808 let sut = makeSUT ( flowType: . implicit)
807809 let url = try sut. getOAuthSignInURL (
808- provider: . github, scopes: " read,write " ,
810+ provider: . github,
811+ scopes: " read,write " ,
809812 redirectTo: URL ( string: " https://dummy-url.com/redirect " ) !,
810813 queryParams: [ ( " extra_key " , " extra_value " ) ]
811814 )
@@ -1496,7 +1499,8 @@ final class AuthClientTests: XCTestCase {
14961499 " id " : " 12345 " ,
14971500 " type " : " totp "
14981501 }
1499- """ . utf8)
1502+ """ . utf8
1503+ )
15001504 ]
15011505 )
15021506 . snapshotRequest {
@@ -1541,7 +1545,8 @@ final class AuthClientTests: XCTestCase {
15411545 " id " : " 12345 " ,
15421546 " type " : " totp "
15431547 }
1544- """ . utf8)
1548+ """ . utf8
1549+ )
15451550 ]
15461551 )
15471552 . snapshotRequest {
@@ -1586,7 +1591,8 @@ final class AuthClientTests: XCTestCase {
15861591 " id " : " 12345 " ,
15871592 " type " : " phone "
15881593 }
1589- """ . utf8)
1594+ """ . utf8
1595+ )
15901596 ]
15911597 )
15921598 . snapshotRequest {
@@ -1634,7 +1640,8 @@ final class AuthClientTests: XCTestCase {
16341640 " type " : " totp " ,
16351641 " expires_at " : 12345678
16361642 }
1637- """ . utf8)
1643+ """ . utf8
1644+ )
16381645 ]
16391646 )
16401647 . snapshotRequest {
@@ -1680,7 +1687,8 @@ final class AuthClientTests: XCTestCase {
16801687 " type " : " phone " ,
16811688 " expires_at " : 12345678
16821689 }
1683- """ . utf8)
1690+ """ . utf8
1691+ )
16841692 ]
16851693 )
16861694 . snapshotRequest {
@@ -1800,7 +1808,8 @@ final class AuthClientTests: XCTestCase {
18001808 " type " : " totp " ,
18011809 " expires_at " : 12345678
18021810 }
1803- """ . utf8)
1811+ """ . utf8
1812+ )
18041813 ]
18051814 )
18061815 . snapshotRequest {
@@ -1955,7 +1964,7 @@ final class AuthClientTests: XCTestCase {
19551964 --header "X-Client-Info: auth-swift/0.0.0" \
19561965 --header "X-Supabase-Api-Version: 2024-01-01" \
19571966 --header "apikey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0" \
1958- "http://localhost:54321/auth/v1/admin/users/859f402d-b3de -4105-a1b9-932836d9193b "
1967+ "http://localhost:54321/auth/v1/admin/users/859F402D-B3DE -4105-A1B9-932836D9193B "
19591968 """#
19601969 }
19611970 . register ( )
@@ -1966,7 +1975,7 @@ final class AuthClientTests: XCTestCase {
19661975 }
19671976
19681977 func testUpdateUserById( ) async throws {
1969- let id = UUID ( uuidString: " 859f402d-b3de-4105-a1b9-932836d9193b " ) !
1978+ let id = UUID ( uuidString: " 859f402d-b3de-4105-a1b9-932836d9193b " ) !
19701979 let sut = makeSUT ( )
19711980
19721981 Mock (
@@ -1984,7 +1993,7 @@ final class AuthClientTests: XCTestCase {
19841993 --header "X-Supabase-Api-Version: 2024-01-01" \
19851994 --header "apikey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0" \
19861995 --data "{\"phone\":\"1234567890\",\"user_metadata\":{\"full_name\":\"John Doe\"}}" \
1987- "http://localhost:54321/auth/v1/admin/users/859f402d-b3de -4105-a1b9-932836d9193b "
1996+ "http://localhost:54321/auth/v1/admin/users/859F402D-B3DE -4105-A1B9-932836D9193B "
19881997 """#
19891998 }
19901999 . register ( )
@@ -2037,21 +2046,26 @@ final class AuthClientTests: XCTestCase {
20372046 func testGenerateLink_signUp( ) async throws {
20382047 let sut = makeSUT ( )
20392048
2049+ let user = User ( fromMockNamed: " user " )
2050+ let encoder = JSONEncoder . supabase ( )
2051+ encoder. keyEncodingStrategy = . convertToSnakeCase
2052+
2053+ let userData = try encoder. encode ( user)
2054+ var json = try JSONSerialization . jsonObject ( with: userData, options: [ ] ) as! [ String : Any ]
2055+
2056+ json [ " action_link " ] = " https://example.com/auth/v1/verify?type=signup&token={hashed_token}&redirect_to=https://example.com "
2057+ json [ " email_otp " ] = " 123456 "
2058+ json [ " hashed_token " ] = " hashed_token "
2059+ json [ " redirect_to " ] = " https://example.com "
2060+ json [ " verification_type " ] = " signup "
2061+
2062+ let responseData = try JSONSerialization . data ( withJSONObject: json)
2063+
20402064 Mock (
20412065 url: clientURL. appendingPathComponent ( " admin/generate_link " ) ,
20422066 statusCode: 200 ,
20432067 data: [
2044- . post: try ! AuthClient . Configuration. jsonEncoder. encode ( [
2045- " properties " : [
2046- " action_link " :
2047- " https://example.com/auth/v1/verify?type=signup&token={hashed_token}&redirect_to=https://example.com " ,
2048- " email_otp " : " 123456 " ,
2049- " hashed_token " : " hashed_token " ,
2050- " redirect_to " : " https://example.com " ,
2051- " verification_type " : " signup " ,
2052- ] ,
2053- " user " : AnyJSON ( User ( fromMockNamed: " user " ) ) ,
2054- ] )
2068+ . post: responseData
20552069 ]
20562070 )
20572071 . register ( )
@@ -2190,13 +2204,16 @@ extension HTTPResponse {
21902204
21912205enum MockData {
21922206 static let listUsersResponse = try ! Data (
2193- contentsOf: Bundle . module. url ( forResource: " list-users-response " , withExtension: " json " ) !)
2207+ contentsOf: Bundle . module. url ( forResource: " list-users-response " , withExtension: " json " ) !
2208+ )
21942209
21952210 static let session = try ! Data (
2196- contentsOf: Bundle . module. url ( forResource: " session " , withExtension: " json " ) !)
2211+ contentsOf: Bundle . module. url ( forResource: " session " , withExtension: " json " ) !
2212+ )
21972213
21982214 static let user = try ! Data (
2199- contentsOf: Bundle . module. url ( forResource: " user " , withExtension: " json " ) !)
2215+ contentsOf: Bundle . module. url ( forResource: " user " , withExtension: " json " ) !
2216+ )
22002217
22012218 static let anonymousSignInResponse = try ! Data (
22022219 contentsOf: Bundle . module. url ( forResource: " anonymous-sign-in-response " , withExtension: " json " ) !
0 commit comments