Skip to content

Commit d6d2000

Browse files
committed
lint fixes
1 parent bde0a72 commit d6d2000

File tree

1 file changed

+34
-25
lines changed

1 file changed

+34
-25
lines changed
Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,56 @@
11
//
2-
// PhoneAuthSignIn.swift
2+
// PhoneAuthTest.swift
33
// SwiftApiTests
44
//
55
// Created by Srushti Vaidya on 12/08/24.
66
// Copyright © 2024 Firebase. All rights reserved.
77
//
88

9-
import Foundation
109
import FirebaseAuth
10+
import Foundation
1111
import XCTest
1212

1313
class PhoneAuthTests: TestsBase {
14-
1514
let kPhoneNumber = "+19999999999"
16-
// This test verification code is specified for the given test phone number in the developer console.
15+
// This test verification code is specified for the given test phone number in the developer
16+
// console.
1717
let kVerificationCode = "777777"
1818

1919
func testSignInWithPhoneNumber() throws {
20-
Auth.auth().settings?.isAppVerificationDisabledForTesting = true //toAdd
21-
let auth = Auth.auth()
22-
let expectation = self.expectation(description: "Sign in with phone number")
20+
Auth.auth().settings?.isAppVerificationDisabledForTesting = true // toAdd
21+
let auth = Auth.auth()
22+
let expectation = self.expectation(description: "Sign in with phone number")
2323

24-
//PhoneAuthProvider used to initiate the Verification process and obtain a verificationID.
25-
PhoneAuthProvider.provider().verifyPhoneNumber(kPhoneNumber, uiDelegate: nil) { verificationID, error in
26-
if let error{
27-
XCTAssertNil(error, "Verification error should be nil")
28-
XCTAssertNotNil(verificationID, "Verification ID should not be nil")
29-
}
24+
// PhoneAuthProvider used to initiate the Verification process and obtain a verificationID.
25+
PhoneAuthProvider.provider()
26+
.verifyPhoneNumber(kPhoneNumber, uiDelegate: nil) { verificationID, error in
27+
if let error {
28+
XCTAssertNil(error, "Verification error should be nil")
29+
XCTAssertNotNil(verificationID, "Verification ID should not be nil")
30+
}
3031

31-
// Create a credential using the test verification code.
32-
let credential = PhoneAuthProvider.provider().credential(withVerificationID: verificationID ?? "", verificationCode: self.kVerificationCode)
33-
//signs in using the credential and verifies that the user is signed in correctly by checking auth.currentUser.
34-
auth.signIn(with: credential) { authResult, error in
35-
if let error{
36-
XCTAssertNil(error, "Sign in error should be nil")
37-
XCTAssertNotNil(authResult, "AuthResult should not be nil")
38-
XCTAssertEqual(auth.currentUser?.phoneNumber, self.kPhoneNumber, "Phone number does not match")
39-
}
40-
expectation.fulfill()
32+
// Create a credential using the test verification code.
33+
let credential = PhoneAuthProvider.provider().credential(
34+
withVerificationID: verificationID ?? "",
35+
verificationCode: self.kVerificationCode
36+
)
37+
// signs in using the credential and verifies that the user is signed in correctly by
38+
// checking auth.currentUser.
39+
auth.signIn(with: credential) { authResult, error in
40+
if let error {
41+
XCTAssertNil(error, "Sign in error should be nil")
42+
XCTAssertNotNil(authResult, "AuthResult should not be nil")
43+
XCTAssertEqual(
44+
auth.currentUser?.phoneNumber,
45+
self.kPhoneNumber,
46+
"Phone number does not match"
47+
)
4148
}
49+
expectation.fulfill()
50+
}
4251
}
4352

44-
waitForExpectations(timeout: TestsBase.kExpectationsTimeout)
45-
//deleteCurrentUser()
53+
waitForExpectations(timeout: TestsBase.kExpectationsTimeout)
54+
// deleteCurrentUser()
4655
}
4756
}

0 commit comments

Comments
 (0)