@@ -618,14 +618,15 @@ final class AuthClientTests: XCTestCase {
618
618
try await sut. session ( from: url)
619
619
XCTFail ( " Expect failure " )
620
620
} catch {
621
- expectNoDifference (
622
- error as? AuthError ,
621
+ assertInlineSnapshot ( of : error , as : . customDump ) {
622
+ """
623
623
AuthError.pkceGrantCodeExchange(
624
624
message: " Identity is already linked to another user " ,
625
625
error: " server_error " ,
626
626
code: " 422 "
627
627
)
628
- )
628
+ """
629
+ }
629
630
}
630
631
}
631
632
@@ -912,7 +913,7 @@ final class AuthClientTests: XCTestCase {
912
913
. snapshotRequest {
913
914
#"""
914
915
curl \
915
- --header "Authorization: bearer accesstoken" \
916
+ --header "Authorization: Bearer accesstoken" \
916
917
--header "X-Client-Info: auth-swift/0.0.0" \
917
918
--header "X-Supabase-Api-Version: 2024-01-01" \
918
919
--header "apikey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0" \
@@ -956,7 +957,7 @@ final class AuthClientTests: XCTestCase {
956
957
. snapshotRequest {
957
958
#"""
958
959
curl \
959
- --header "Authorization: bearer accesstoken" \
960
+ --header "Authorization: Bearer accesstoken" \
960
961
--header "X-Client-Info: auth-swift/0.0.0" \
961
962
--header "X-Supabase-Api-Version: 2024-01-01" \
962
963
--header "apikey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0" \
@@ -984,8 +985,12 @@ final class AuthClientTests: XCTestCase {
984
985
985
986
do {
986
987
try await sut. session ( from: url)
987
- } catch let AuthError . implicitGrantRedirect( message) {
988
- expectNoDifference ( message, " Not a valid implicit grant flow URL: \( url) " )
988
+ } catch {
989
+ assertInlineSnapshot ( of: error, as: . customDump) {
990
+ """
991
+ AuthError.implicitGrantRedirect(message: " Not a valid implicit grant flow URL: https://dummy-url.com/callback#invalid_key=accesstoken&expires_in=60&refresh_token=refreshtoken&token_type=bearer " )
992
+ """
993
+ }
989
994
}
990
995
}
991
996
@@ -999,8 +1004,12 @@ final class AuthClientTests: XCTestCase {
999
1004
1000
1005
do {
1001
1006
try await sut. session ( from: url)
1002
- } catch let AuthError . implicitGrantRedirect( message) {
1003
- expectNoDifference ( message, " Invalid code " )
1007
+ } catch {
1008
+ assertInlineSnapshot ( of: error, as: . customDump) {
1009
+ """
1010
+ AuthError.implicitGrantRedirect(message: " Invalid code " )
1011
+ """
1012
+ }
1004
1013
}
1005
1014
}
1006
1015
@@ -1015,7 +1024,7 @@ final class AuthClientTests: XCTestCase {
1015
1024
. snapshotRequest {
1016
1025
#"""
1017
1026
curl \
1018
- --header "Authorization: bearer accesstoken" \
1027
+ --header "Authorization: Bearer accesstoken" \
1019
1028
--header "X-Client-Info: auth-swift/0.0.0" \
1020
1029
--header "X-Supabase-Api-Version: 2024-01-01" \
1021
1030
--header "apikey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0" \
@@ -1053,10 +1062,16 @@ final class AuthClientTests: XCTestCase {
1053
1062
1054
1063
do {
1055
1064
try await sut. session ( from: url)
1056
- } catch let AuthError . pkceGrantCodeExchange( message, error, code) {
1057
- expectNoDifference ( message, " Invalid code " )
1058
- expectNoDifference ( error, " invalid_grant " )
1059
- expectNoDifference ( code, " 500 " )
1065
+ } catch {
1066
+ assertInlineSnapshot ( of: error, as: . customDump) {
1067
+ """
1068
+ AuthError.pkceGrantCodeExchange(
1069
+ message: " Invalid code " ,
1070
+ error: " invalid_grant " ,
1071
+ code: " 500 "
1072
+ )
1073
+ """
1074
+ }
1060
1075
}
1061
1076
}
1062
1077
@@ -1070,10 +1085,16 @@ final class AuthClientTests: XCTestCase {
1070
1085
1071
1086
do {
1072
1087
try await sut. session ( from: url)
1073
- } catch let AuthError . pkceGrantCodeExchange( message, error, code) {
1074
- expectNoDifference ( message, " Error in URL with unspecified error_description. " )
1075
- expectNoDifference ( error, " invalid_grant " )
1076
- expectNoDifference ( code, " 500 " )
1088
+ } catch {
1089
+ assertInlineSnapshot ( of: error, as: . customDump) {
1090
+ """
1091
+ AuthError.pkceGrantCodeExchange(
1092
+ message: " Error in URL with unspecified error_description. " ,
1093
+ error: " invalid_grant " ,
1094
+ code: " 500 "
1095
+ )
1096
+ """
1097
+ }
1077
1098
}
1078
1099
}
1079
1100
@@ -2197,7 +2218,11 @@ final class AuthClientTests: XCTestCase {
2197
2218
_ = try await sut. user ( )
2198
2219
XCTFail ( " Expected failure " )
2199
2220
} catch {
2200
- XCTAssertEqual ( error as? AuthError , . sessionMissing)
2221
+ assertInlineSnapshot ( of: error, as: . customDump) {
2222
+ """
2223
+ AuthError.sessionMissing
2224
+ """
2225
+ }
2201
2226
}
2202
2227
} ,
2203
2228
expectedEvents: [ . initialSession, . signedOut]
@@ -2236,7 +2261,13 @@ final class AuthClientTests: XCTestCase {
2236
2261
_ = try await sut. session
2237
2262
XCTFail ( " Expected failure " )
2238
2263
} catch {
2239
- XCTAssertEqual ( error as? AuthError , . sessionMissing)
2264
+ assertInlineSnapshot ( of: error, as: . customDump) {
2265
+ """
2266
+ AFError.responseValidationFailed(
2267
+ reason: .customValidationFailed(error: .sessionMissing)
2268
+ )
2269
+ """
2270
+ }
2240
2271
}
2241
2272
} ,
2242
2273
expectedEvents: [ . signedOut]
@@ -2248,7 +2279,6 @@ final class AuthClientTests: XCTestCase {
2248
2279
private func makeSUT( flowType: AuthFlowType = . pkce) -> AuthClient {
2249
2280
let sessionConfiguration = URLSessionConfiguration . default
2250
2281
sessionConfiguration. protocolClasses = [ MockingURLProtocol . self]
2251
- let session = URLSession ( configuration: sessionConfiguration)
2252
2282
2253
2283
let encoder = AuthClient . Configuration. jsonEncoder
2254
2284
encoder. outputFormatting = [ . sortedKeys]
0 commit comments