@@ -29,6 +29,14 @@ class FinalizeMFAEnrollmentRequestTests: RPCBaseTests {
2929 @brief Tests the Finalize MFA Enrollment using TOTP request.
3030 */
3131 func testTOTPStartMFAEnrollmentRequest( ) async throws {
32+ try await assertTOTPStartMFAEnrollmentRequest ( displayName: " sparky " )
33+ }
34+
35+ func testTOTPStartMFAEnrollmentRequest_WhenDisplayNameIsNil( ) async throws {
36+ try await assertTOTPStartMFAEnrollmentRequest ( displayName: nil )
37+ }
38+
39+ func assertTOTPStartMFAEnrollmentRequest( displayName: String ? ) async throws {
3240 let kIDToken = " idToken "
3341 let kDisplayName = " displayName "
3442 let kSessionInfo = " sessionInfo "
@@ -40,7 +48,7 @@ class FinalizeMFAEnrollmentRequestTests: RPCBaseTests {
4048 let requestInfo = AuthProtoFinalizeMFATOTPEnrollmentRequestInfo ( sessionInfo: kSessionInfo,
4149 verificationCode: kVerificationCode)
4250 let request = FinalizeMFAEnrollmentRequest ( idToken: kIDToken,
43- displayName: kDisplayName ,
51+ displayName: displayName ,
4452 totpVerificationInfo: requestInfo,
4553 requestConfiguration: requestConfiguration)
4654
@@ -55,7 +63,7 @@ class FinalizeMFAEnrollmentRequestTests: RPCBaseTests {
5563 value: kIDToken
5664 )
5765 let requestDictionary = try XCTUnwrap ( rpcIssuer. decodedRequest as? [ String : AnyHashable ] )
58- XCTAssertEqual ( requestDictionary [ kDisplayName] , kDisplayName )
66+ XCTAssertEqual ( requestDictionary [ kDisplayName] , displayName )
5967 let totpInfo = try XCTUnwrap ( requestDictionary [ kTOTPVerificationInfo] as? [ String : String ] )
6068 XCTAssertEqual ( totpInfo [ " verificationCode " ] , kVerificationCode)
6169 XCTAssertNil ( requestDictionary [ kPhoneVerificationInfo] )
0 commit comments