Skip to content

Commit 621886e

Browse files
committed
3.1.8
1 parent 9172a53 commit 621886e

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

MSAL/test/integration/native_auth/end_to_end/reset_password/MSALNativeAuthResetPasswordEndToEndTests.swift

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,12 @@ final class MSALNativeAuthResetPasswordEndToEndTests: MSALNativeAuthEndToEndBase
108108
let resetPasswordCompletedExp = expectation(description: "reset password completed")
109109
let resetPasswordRequiredDelegate = ResetPasswordRequiredDelegateSpy(expectation: resetPasswordCompletedExp)
110110

111-
let uniquePassword = "INVALID_Passwprd"
111+
let uniquePassword = "INVALID_PASSWORD"
112112
newPasswordRequiredState?.submitPassword(password: uniquePassword, delegate: resetPasswordRequiredDelegate)
113113

114114
await fulfillment(of: [resetPasswordCompletedExp])
115-
XCTAssertTrue(resetPasswordRequiredDelegate.onResetPasswordCompletedCalled)
115+
XCTAssertTrue(resetPasswordRequiredDelegate.onResetPasswordRequiredErrorCalled)
116+
XCTAssertEqual(resetPasswordRequiredDelegate.error?.isInvalidPassword, true)
116117
}
117118

118119
// User Case 3.1.4 SSPR - Resend email OTP
@@ -225,7 +226,25 @@ final class MSALNativeAuthResetPasswordEndToEndTests: MSALNativeAuthEndToEndBase
225226
}
226227

227228
// User Case 3.1.8 SSPR – Email exists but not linked to any password
228-
// Not applicable
229+
func test_resetPassword_accoutWithoutPassword_error() async throws {
230+
guard let sut = initialisePublicClientApplication(),
231+
let username = retrieveUsernameForSignInCode()
232+
else {
233+
XCTFail("Missing information")
234+
return
235+
}
236+
237+
let resetPasswordFailureExp = expectation(description: "does not support password")
238+
let resetPasswordStartDelegate = ResetPasswordStartDelegateSpy(expectation: resetPasswordFailureExp)
239+
240+
sut.resetPassword(username: username, delegate: resetPasswordStartDelegate)
241+
242+
await fulfillment(of: [resetPasswordFailureExp])
243+
244+
// Verify error condition
245+
XCTAssertTrue(resetPasswordStartDelegate.onResetPasswordErrorCalled)
246+
XCTAssertTrue(resetPasswordStartDelegate.error?.errorDescription!.contains("The tenant or user does not support native credential recovery."))
247+
}
229248

230249
// User Case 3.1.9 - Email exists but signup method was OTP, social, etc.
231250
func test_resetPassword_socialAccount_error() async throws {

0 commit comments

Comments
 (0)