Skip to content

Commit 9172a53

Browse files
committed
Add throw and full process for the resend
1 parent cfced39 commit 9172a53

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

MSAL/test/integration/native_auth/end_to_end/sign_in/MSALNativeAuthSignInUsernameEndToEndTests.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ final class MSALNativeAuthSignInUsernameEndToEndTests: MSALNativeAuthEndToEndBas
113113

114114
// User Case 2.2.5 Sign In - Resend email OTP
115115
func test_signUpWithEmailOTP_resendEmail_success() async throws {
116+
throw XCTSkip("Retrieving OTP failure")
117+
116118
guard let sut = initialisePublicClientApplication(clientIdType: .code), let username = retrieveUsernameForSignInCode() else {
117119
XCTFail("Missing information")
118120
return
@@ -159,6 +161,19 @@ final class MSALNativeAuthSignInUsernameEndToEndTests: MSALNativeAuthEndToEndBas
159161

160162
// Verify that the codes are different
161163
XCTAssertNotEqual(code1, code2, "Resent code should be different from the original code")
164+
165+
// Now submit the code..
166+
let verifyCodeExpectation = expectation(description: "verifying code")
167+
let signInVerifyCodeDelegateSpy = SignInVerifyCodeDelegateSpy(expectation: verifyCodeExpectation)
168+
169+
signInDelegate.newStateCodeRequired?.submitCode(code: code2, delegate: signInVerifyCodeDelegateSpy)
170+
171+
await fulfillment(of: [verifyCodeExpectation])
172+
173+
XCTAssertTrue(signInVerifyCodeDelegateSpy.onSignInCompletedCalled)
174+
XCTAssertNotNil(signInVerifyCodeDelegateSpy.result)
175+
XCTAssertNotNil(signInVerifyCodeDelegateSpy.result?.idToken)
176+
XCTAssertEqual(signInVerifyCodeDelegateSpy.result?.account.username, username)
162177
}
163178

164179
/* User Case 2.2.6 Sign In - Ability to provide scope to control auth strength of the token

0 commit comments

Comments
 (0)