@@ -575,10 +575,10 @@ - (void)testUnparsableSuccessResponse {
575575/* * @fn testNonDictionaryErrorResponse
576576 @brief This test checks the behaviour of @c postWithRequest:response:callback: when the
577577 response deserialized by @c NSJSONSerialization is not a dictionary, and an error was
578- expected. We are expecting to receive an @c NSError with the code
579- @c FIRAuthErrorCodeUnexpectedErrorServerResponse with the decoded response in the
580- @c NSError.userInfo dictionary associated with the key
581- @c FIRAuthErrorUserInfoDecodedResponseKey .
578+ expected. We are expecting to receive the original network error wrapped in an @c NSError
579+ with the code @c FIRAuthInternalErrorCodeUnexpectedErrorResponse with the decoded response
580+ in the @c NSError.userInfo dictionary associated with the key
581+ @c FIRAuthErrorUserInfoDeserializedResponseKey .
582582 */
583583- (void )testNonDictionaryErrorResponse {
584584 FIRFakeRequest *request = [FIRFakeRequest fakeRequest ];
@@ -613,7 +613,9 @@ - (void)testNonDictionaryErrorResponse {
613613 XCTAssertEqual (underlyingError.code , FIRAuthInternalErrorCodeUnexpectedErrorResponse);
614614
615615 NSError *underlyingUnderlyingError = underlyingError.userInfo [NSUnderlyingErrorKey ];
616- XCTAssertNil (underlyingUnderlyingError);
616+ XCTAssertNotNil (underlyingUnderlyingError);
617+ XCTAssertEqualObjects (underlyingUnderlyingError.domain , kFakeErrorDomain );
618+ XCTAssertEqual (underlyingUnderlyingError.code , kFakeErrorCode );
617619
618620 id deserializedResponse = underlyingError.userInfo [FIRAuthErrorUserInfoDeserializedResponseKey];
619621 XCTAssertNotNil (deserializedResponse);
@@ -677,9 +679,9 @@ - (void)testNonDictionarySuccessResponse {
677679 @brief This test checks the behaviour of @c postWithRequest:response:callback: when the
678680 we get an error message indicating captcha is required. The backend should not be returning
679681 this error to mobile clients. If it does, we should wrap it in an @c NSError with the code
680- @c FIRAuthErrorCodeUnexpectedServerResponse with the decoded error message in the
682+ @c FIRAuthInternalErrorCodeUnexpectedErrorResponse with the decoded error message in the
681683 @c NSError.userInfo dictionary associated with the key
682- @c FIRAuthErrorUserInfoDecodedErrorResponseKey .
684+ @c FIRAuthErrorUserInfoDeserializedResponseKey .
683685 */
684686- (void )testCaptchaRequiredResponse {
685687 FIRFakeRequest *request = [FIRFakeRequest fakeRequest ];
@@ -709,7 +711,9 @@ - (void)testCaptchaRequiredResponse {
709711 XCTAssertEqual (underlyingError.code , FIRAuthInternalErrorCodeUnexpectedErrorResponse);
710712
711713 NSError *underlyingUnderlyingError = underlyingError.userInfo [NSUnderlyingErrorKey ];
712- XCTAssertNil (underlyingUnderlyingError);
714+ XCTAssertNotNil (underlyingUnderlyingError);
715+ XCTAssertEqualObjects (underlyingUnderlyingError.domain , kFakeErrorDomain );
716+ XCTAssertEqual (underlyingUnderlyingError.code , kFakeErrorCode );
713717
714718 id deserializedResponse = underlyingError.userInfo [FIRAuthErrorUserInfoDeserializedResponseKey];
715719 XCTAssertNotNil (deserializedResponse);
@@ -756,9 +760,9 @@ - (void)testCaptchaCheckFailedResponse {
756760 we get an error message indicating captcha is required and an invalid password was entered.
757761 The backend should not be returning this error to mobile clients. If it does, we should wrap
758762 it in an @c NSError with the code
759- @c FIRAuthErrorCodeUnexpectedServerResponse with the decoded error message in the
763+ @c FIRAuthInternalErrorCodeUnexpectedErrorResponse with the decoded error message in the
760764 @c NSError.userInfo dictionary associated with the key
761- @c FIRAuthErrorUserInfoDecodedErrorResponseKey .
765+ @c FIRAuthErrorUserInfoDeserializedResponseKey .
762766 */
763767- (void )testCaptchaRequiredInvalidPasswordResponse {
764768 FIRFakeRequest *request = [FIRFakeRequest fakeRequest ];
@@ -789,7 +793,9 @@ - (void)testCaptchaRequiredInvalidPasswordResponse {
789793 XCTAssertEqual (underlyingError.code , FIRAuthInternalErrorCodeUnexpectedErrorResponse);
790794
791795 NSError *underlyingUnderlyingError = underlyingError.userInfo [NSUnderlyingErrorKey ];
792- XCTAssertNil (underlyingUnderlyingError);
796+ XCTAssertNotNil (underlyingUnderlyingError);
797+ XCTAssertEqualObjects (underlyingUnderlyingError.domain , kFakeErrorDomain );
798+ XCTAssertEqual (underlyingUnderlyingError.code , kFakeErrorCode );
793799
794800 id deserializedResponse = underlyingError.userInfo [FIRAuthErrorUserInfoDeserializedResponseKey];
795801 XCTAssertNotNil (deserializedResponse);
@@ -804,9 +810,10 @@ - (void)testCaptchaRequiredInvalidPasswordResponse {
804810 @brief This test checks the behaviour of @c postWithRequest:response:callback: when the
805811 response deserialized by @c NSJSONSerialization represents a valid error response (and an
806812 error was indicated) but we didn't receive an error message we know about. We are expecting
807- an @c NSError with the code @c FIRAuthErrorCodeUnexpectedServerResponse with the decoded
813+ to receive the original network error wrapped in an @c NSError with the code
814+ @c FIRAuthInternalErrorCodeUnexpectedErrorResponse with the decoded
808815 error message in the @c NSError.userInfo dictionary associated with the key
809- @c FIRAuthErrorUserInfoDecodedErrorResponseKey .
816+ @c FIRAuthErrorUserInfoDeserializedResponseKey .
810817 */
811818- (void )testDecodableErrorResponseWithUnknownMessage {
812819 FIRFakeRequest *request = [FIRFakeRequest fakeRequest ];
@@ -838,7 +845,9 @@ - (void)testDecodableErrorResponseWithUnknownMessage {
838845 XCTAssertEqual (underlyingError.code , FIRAuthInternalErrorCodeUnexpectedErrorResponse);
839846
840847 NSError *underlyingUnderlyingError = underlyingError.userInfo [NSUnderlyingErrorKey ];
841- XCTAssertNil (underlyingUnderlyingError);
848+ XCTAssertNotNil (underlyingUnderlyingError);
849+ XCTAssertEqualObjects (underlyingUnderlyingError.domain , kFakeErrorDomain );
850+ XCTAssertEqual (underlyingUnderlyingError.code , kFakeErrorCode );
842851
843852 id deserializedResponse = underlyingError.userInfo [FIRAuthErrorUserInfoDeserializedResponseKey];
844853 XCTAssertNotNil (deserializedResponse);
@@ -852,10 +861,11 @@ - (void)testDecodableErrorResponseWithUnknownMessage {
852861/* * @fn testErrorResponseWithNoErrorMessage
853862 @brief This test checks the behaviour of @c postWithRequest:response:callback: when the
854863 response deserialized by @c NSJSONSerialization is a dictionary, and an error was indicated,
855- but no error information was present in the decoded response. We are expecting an @c NSError
856- with the code @c FIRAuthErrorCodeUnexpectedServerResponse with the decoded
864+ but no error information was present in the decoded response. We are expecting to receive
865+ the original network error wrapped in an @c NSError with the code
866+ @c FIRAuthErrorCodeUnexpectedServerResponse with the decoded
857867 response message in the @c NSError.userInfo dictionary associated with the key
858- @c FIRAuthErrorUserInfoDecodedResponseKey .
868+ @c FIRAuthErrorUserInfoDeserializedResponseKey .
859869 */
860870- (void )testErrorResponseWithNoErrorMessage {
861871 FIRFakeRequest *request = [FIRFakeRequest fakeRequest ];
@@ -885,7 +895,9 @@ - (void)testErrorResponseWithNoErrorMessage {
885895 XCTAssertEqual (underlyingError.code , FIRAuthInternalErrorCodeUnexpectedErrorResponse);
886896
887897 NSError *underlyingUnderlyingError = underlyingError.userInfo [NSUnderlyingErrorKey ];
888- XCTAssertNil (underlyingUnderlyingError);
898+ XCTAssertNotNil (underlyingUnderlyingError);
899+ XCTAssertEqualObjects (underlyingUnderlyingError.domain , kFakeErrorDomain );
900+ XCTAssertEqual (underlyingUnderlyingError.code , kFakeErrorCode );
889901
890902 id deserializedResponse = underlyingError.userInfo [FIRAuthErrorUserInfoDeserializedResponseKey];
891903 XCTAssertNotNil (deserializedResponse);
0 commit comments