@@ -45,6 +45,8 @@ final class FunctionsErrorTests: XCTestCase {
45
45
// The error should be `nil`.
46
46
let error = FunctionsError (
47
47
httpStatusCode: 200 ,
48
+ region: " my-region " ,
49
+ url: URL ( string: " https://example.com/fake_func " ) !,
48
50
body: nil ,
49
51
serializer: FunctionsSerializer ( )
50
52
)
@@ -56,6 +58,8 @@ final class FunctionsErrorTests: XCTestCase {
56
58
// The error should be inferred from the HTTP status code.
57
59
let error = FunctionsError (
58
60
httpStatusCode: 429 ,
61
+ region: " my-region " ,
62
+ url: URL ( string: " https://example.com/fake_func " ) !,
59
63
body: nil ,
60
64
serializer: FunctionsSerializer ( )
61
65
)
@@ -66,7 +70,7 @@ final class FunctionsErrorTests: XCTestCase {
66
70
XCTAssertEqual ( nsError. domain, " com.firebase.functions " )
67
71
XCTAssertEqual ( nsError. code, 8 )
68
72
XCTAssertEqual ( nsError. localizedDescription, " RESOURCE EXHAUSTED " )
69
- XCTAssertEqual ( nsError. userInfo. count, 1 )
73
+ XCTAssertEqual ( nsError. userInfo. count, 3 )
70
74
}
71
75
72
76
func testInitWithOKStatusCodeAndIncompleteErrorBody( ) {
@@ -75,6 +79,8 @@ final class FunctionsErrorTests: XCTestCase {
75
79
76
80
let error = FunctionsError (
77
81
httpStatusCode: 200 ,
82
+ region: " my-region " ,
83
+ url: URL ( string: " https://example.com/fake_func " ) !,
78
84
body: responseData,
79
85
serializer: FunctionsSerializer ( )
80
86
)
@@ -85,7 +91,7 @@ final class FunctionsErrorTests: XCTestCase {
85
91
XCTAssertEqual ( nsError. domain, " com.firebase.functions " )
86
92
XCTAssertEqual ( nsError. code, 11 )
87
93
XCTAssertEqual ( nsError. localizedDescription, " OUT OF RANGE " )
88
- XCTAssertEqual ( nsError. userInfo. count, 1 )
94
+ XCTAssertEqual ( nsError. userInfo. count, 3 )
89
95
}
90
96
91
97
func testInitWithErrorStatusCodeAndErrorBody( ) {
@@ -96,6 +102,8 @@ final class FunctionsErrorTests: XCTestCase {
96
102
97
103
let error = FunctionsError (
98
104
httpStatusCode: 499 ,
105
+ region: " my-region " ,
106
+ url: URL ( string: " https://example.com/fake_func " ) !,
99
107
body: responseData,
100
108
serializer: FunctionsSerializer ( )
101
109
)
@@ -106,7 +114,7 @@ final class FunctionsErrorTests: XCTestCase {
106
114
XCTAssertEqual ( nsError. domain, " com.firebase.functions " )
107
115
XCTAssertEqual ( nsError. code, 11 )
108
116
XCTAssertEqual ( nsError. localizedDescription, " TEST_ErrorMessage " )
109
- XCTAssertEqual ( nsError. userInfo. count, 2 )
117
+ XCTAssertEqual ( nsError. userInfo. count, 4 )
110
118
XCTAssertEqual ( nsError. userInfo [ " details " ] as? Int , 123 )
111
119
}
112
120
@@ -119,6 +127,8 @@ final class FunctionsErrorTests: XCTestCase {
119
127
120
128
let error = FunctionsError (
121
129
httpStatusCode: 401 ,
130
+ region: " my-region " ,
131
+ url: URL ( string: " https://example.com/fake_func " ) !,
122
132
body: responseData,
123
133
serializer: FunctionsSerializer ( )
124
134
)
@@ -133,6 +143,8 @@ final class FunctionsErrorTests: XCTestCase {
133
143
134
144
let error = FunctionsError (
135
145
httpStatusCode: 403 ,
146
+ region: " my-region " ,
147
+ url: URL ( string: " https://example.com/fake_func " ) !,
136
148
body: responseData,
137
149
serializer: FunctionsSerializer ( )
138
150
)
@@ -143,7 +155,7 @@ final class FunctionsErrorTests: XCTestCase {
143
155
XCTAssertEqual ( nsError. domain, " com.firebase.functions " )
144
156
XCTAssertEqual ( nsError. code, 7 ) // `permissionDenied`, inferred from the HTTP status code
145
157
XCTAssertEqual ( nsError. localizedDescription, " TEST_ErrorMessage " )
146
- XCTAssertEqual ( nsError. userInfo. count, 2 )
158
+ XCTAssertEqual ( nsError. userInfo. count, 4 )
147
159
XCTAssertEqual ( nsError. userInfo [ " details " ] as? NSNull , NSNull ( ) )
148
160
}
149
161
@@ -155,6 +167,8 @@ final class FunctionsErrorTests: XCTestCase {
155
167
156
168
let error = FunctionsError (
157
169
httpStatusCode: 503 ,
170
+ region: " my-region " ,
171
+ url: URL ( string: " https://example.com/fake_func " ) !,
158
172
body: responseData,
159
173
serializer: FunctionsSerializer ( )
160
174
)
0 commit comments