13
13
* See the License for the specific language governing permissions and
14
14
* limitations under the License.
15
15
*/
16
- // PhoneAuthTest.swift
17
- // SwiftApiTests
18
16
19
17
import FirebaseAuth
20
18
import Foundation
21
19
import XCTest
22
20
23
21
class PhoneAuthTests : TestsBase {
24
- let kPhoneNumber = " +19999999999 "
22
+ let phoneNumber = " +12345678910 "
25
23
// This test verification code is specified for the given test phone number in the developer
26
24
// console.
27
- let kVerificationCode = " 777777 "
25
+ let verificationCode = " 123456 "
28
26
29
27
func testSignInWithPhoneNumber( ) throws {
30
28
Auth . auth ( ) . settings? . isAppVerificationDisabledForTesting = true // toAdd
@@ -33,7 +31,7 @@ class PhoneAuthTests: TestsBase {
33
31
34
32
// PhoneAuthProvider used to initiate the Verification process and obtain a verificationID.
35
33
PhoneAuthProvider . provider ( )
36
- . verifyPhoneNumber ( kPhoneNumber , uiDelegate: nil ) { verificationID, error in
34
+ . verifyPhoneNumber ( phoneNumber , uiDelegate: nil ) { verificationID, error in
37
35
if let error {
38
36
XCTAssertNil ( error, " Verification error should be nil " )
39
37
XCTAssertNotNil ( verificationID, " Verification ID should not be nil " )
@@ -42,17 +40,17 @@ class PhoneAuthTests: TestsBase {
42
40
// Create a credential using the test verification code.
43
41
let credential = PhoneAuthProvider . provider ( ) . credential (
44
42
withVerificationID: verificationID ?? " " ,
45
- verificationCode: self . kVerificationCode
43
+ verificationCode: self . verificationCode
46
44
)
47
- // signs in using the credential and verifies that the user is signed in correctly by
45
+ // Signs in using the credential and verifies that the user is signed in correctly by
48
46
// checking auth.currentUser.
49
47
auth. signIn ( with: credential) { authResult, error in
50
48
if let error {
51
49
XCTAssertNil ( error, " Sign in error should be nil " )
52
50
XCTAssertNotNil ( authResult, " AuthResult should not be nil " )
53
51
XCTAssertEqual (
54
52
auth. currentUser? . phoneNumber,
55
- self . kPhoneNumber ,
53
+ self . phoneNumber ,
56
54
" Phone number does not match "
57
55
)
58
56
}
@@ -61,6 +59,5 @@ class PhoneAuthTests: TestsBase {
61
59
}
62
60
63
61
waitForExpectations ( timeout: TestsBase . kExpectationsTimeout)
64
- // deleteCurrentUser()
65
62
}
66
63
}
0 commit comments