@@ -45,6 +45,8 @@ final class FunctionsErrorTests: XCTestCase {
4545 // The error should be `nil`.
4646 let error = FunctionsError (
4747 httpStatusCode: 200 ,
48+ region: " my-region " ,
49+ url: URL ( string: " https://example.com/fake_func " ) !,
4850 body: nil ,
4951 serializer: FunctionsSerializer ( )
5052 )
@@ -56,6 +58,8 @@ final class FunctionsErrorTests: XCTestCase {
5658 // The error should be inferred from the HTTP status code.
5759 let error = FunctionsError (
5860 httpStatusCode: 429 ,
61+ region: " my-region " ,
62+ url: URL ( string: " https://example.com/fake_func " ) !,
5963 body: nil ,
6064 serializer: FunctionsSerializer ( )
6165 )
@@ -66,7 +70,7 @@ final class FunctionsErrorTests: XCTestCase {
6670 XCTAssertEqual ( nsError. domain, " com.firebase.functions " )
6771 XCTAssertEqual ( nsError. code, 8 )
6872 XCTAssertEqual ( nsError. localizedDescription, " RESOURCE EXHAUSTED " )
69- XCTAssertEqual ( nsError. userInfo. count, 1 )
73+ XCTAssertEqual ( nsError. userInfo. count, 3 )
7074 }
7175
7276 func testInitWithOKStatusCodeAndIncompleteErrorBody( ) {
@@ -75,6 +79,8 @@ final class FunctionsErrorTests: XCTestCase {
7579
7680 let error = FunctionsError (
7781 httpStatusCode: 200 ,
82+ region: " my-region " ,
83+ url: URL ( string: " https://example.com/fake_func " ) !,
7884 body: responseData,
7985 serializer: FunctionsSerializer ( )
8086 )
@@ -85,7 +91,7 @@ final class FunctionsErrorTests: XCTestCase {
8591 XCTAssertEqual ( nsError. domain, " com.firebase.functions " )
8692 XCTAssertEqual ( nsError. code, 11 )
8793 XCTAssertEqual ( nsError. localizedDescription, " OUT OF RANGE " )
88- XCTAssertEqual ( nsError. userInfo. count, 1 )
94+ XCTAssertEqual ( nsError. userInfo. count, 3 )
8995 }
9096
9197 func testInitWithErrorStatusCodeAndErrorBody( ) {
@@ -96,6 +102,8 @@ final class FunctionsErrorTests: XCTestCase {
96102
97103 let error = FunctionsError (
98104 httpStatusCode: 499 ,
105+ region: " my-region " ,
106+ url: URL ( string: " https://example.com/fake_func " ) !,
99107 body: responseData,
100108 serializer: FunctionsSerializer ( )
101109 )
@@ -106,7 +114,7 @@ final class FunctionsErrorTests: XCTestCase {
106114 XCTAssertEqual ( nsError. domain, " com.firebase.functions " )
107115 XCTAssertEqual ( nsError. code, 11 )
108116 XCTAssertEqual ( nsError. localizedDescription, " TEST_ErrorMessage " )
109- XCTAssertEqual ( nsError. userInfo. count, 2 )
117+ XCTAssertEqual ( nsError. userInfo. count, 4 )
110118 XCTAssertEqual ( nsError. userInfo [ " details " ] as? Int , 123 )
111119 }
112120
@@ -119,6 +127,8 @@ final class FunctionsErrorTests: XCTestCase {
119127
120128 let error = FunctionsError (
121129 httpStatusCode: 401 ,
130+ region: " my-region " ,
131+ url: URL ( string: " https://example.com/fake_func " ) !,
122132 body: responseData,
123133 serializer: FunctionsSerializer ( )
124134 )
@@ -133,6 +143,8 @@ final class FunctionsErrorTests: XCTestCase {
133143
134144 let error = FunctionsError (
135145 httpStatusCode: 403 ,
146+ region: " my-region " ,
147+ url: URL ( string: " https://example.com/fake_func " ) !,
136148 body: responseData,
137149 serializer: FunctionsSerializer ( )
138150 )
@@ -143,7 +155,7 @@ final class FunctionsErrorTests: XCTestCase {
143155 XCTAssertEqual ( nsError. domain, " com.firebase.functions " )
144156 XCTAssertEqual ( nsError. code, 7 ) // `permissionDenied`, inferred from the HTTP status code
145157 XCTAssertEqual ( nsError. localizedDescription, " TEST_ErrorMessage " )
146- XCTAssertEqual ( nsError. userInfo. count, 2 )
158+ XCTAssertEqual ( nsError. userInfo. count, 4 )
147159 XCTAssertEqual ( nsError. userInfo [ " details " ] as? NSNull , NSNull ( ) )
148160 }
149161
@@ -155,6 +167,8 @@ final class FunctionsErrorTests: XCTestCase {
155167
156168 let error = FunctionsError (
157169 httpStatusCode: 503 ,
170+ region: " my-region " ,
171+ url: URL ( string: " https://example.com/fake_func " ) !,
158172 body: responseData,
159173 serializer: FunctionsSerializer ( )
160174 )
0 commit comments