@@ -1339,16 +1339,25 @@ function testStartSignInWithEmailAndPassword_success() {
1339
1339
app . getAuth ( ) . install ( ) ;
1340
1340
app . getExternalAuth ( ) . install ( ) ;
1341
1341
asyncTestCase . waitForSignals ( 1 ) ;
1342
+ var expectedUserCredential = {
1343
+ 'user' : expectedUser ,
1344
+ 'credential' : null ,
1345
+ 'operationType' : 'signIn' ,
1346
+ 'additionalUserInfo' : { 'providerId' : 'password' , 'isNewUser' : false }
1347
+ } ;
1342
1348
app . startSignInWithEmailAndPassword ( '[email protected] ' , 'password' )
1343
- . then ( function ( user ) {
1344
- assertEquals ( app . getAuth ( ) . currentUser , user ) ;
1349
+ . then ( function ( userCredential ) {
1350
+ assertObjectEquals ( expectedUserCredential , userCredential ) ;
1345
1351
asyncTestCase . signal ( ) ;
1346
1352
} ) ;
1347
- app . getAuth ( ) . assertSignInWithEmailAndPassword (
1353
+ app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1348
1354
[ '[email protected] ' , 'password' ] ,
1349
1355
function ( ) {
1350
1356
app . getAuth ( ) . setUser ( expectedUser ) ;
1351
- return app . getAuth ( ) . currentUser ;
1357
+ // Make a copy of expected UserCredential to ensure
1358
+ // expectedUserCredential which is used to be compared with later will
1359
+ // not be modified.
1360
+ return goog . object . clone ( expectedUserCredential ) ;
1352
1361
} ) ;
1353
1362
app . getAuth ( ) . process ( ) ;
1354
1363
app . getExternalAuth ( ) . process ( ) ;
@@ -1371,7 +1380,7 @@ function testStartSignInWithEmailAndPassword_error() {
1371
1380
assertEquals ( expectedError , error ) ;
1372
1381
asyncTestCase . signal ( ) ;
1373
1382
} ) ;
1374
- app . getAuth ( ) . assertSignInWithEmailAndPassword (
1383
+ app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1375
1384
[ '[email protected] ' , 'password' ] ,
1376
1385
null ,
1377
1386
expectedError ) ;
@@ -1418,11 +1427,16 @@ function testStartSignInWithEmailAndPassword_upgradeAnon_isAnonymous_success() {
1418
1427
} ) ;
1419
1428
// Simulate anonymous user logged in on external instance.
1420
1429
testAuth . setUser ( anonymousUser ) ;
1421
- app . getAuth ( ) . assertSignInWithEmailAndPassword (
1430
+ app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1422
1431
[ '[email protected] ' , 'password' ] ,
1423
1432
function ( ) {
1424
1433
app . getAuth ( ) . setUser ( expectedUser ) ;
1425
- return app . getAuth ( ) . currentUser ;
1434
+ return {
1435
+ 'user' : expectedUser ,
1436
+ 'credential' : null ,
1437
+ 'operationType' : 'signIn' ,
1438
+ 'additionalUserInfo' : { 'providerId' : 'password' , 'isNewUser' : false }
1439
+ } ;
1426
1440
} ) ;
1427
1441
app . getAuth ( ) . process ( ) . then ( function ( ) {
1428
1442
// Trigger initial onAuthStateChanged listener.
@@ -1466,7 +1480,7 @@ function testStartSignInWithEmailAndPassword_upgradeAnon_isAnon_error() {
1466
1480
asyncTestCase . signal ( ) ;
1467
1481
} ) ;
1468
1482
// Simulate wrong password error on sign-in.
1469
- app . getAuth ( ) . assertSignInWithEmailAndPassword (
1483
+ app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1470
1484
[ '[email protected] ' , 'password' ] ,
1471
1485
null ,
1472
1486
expectedError ) ;
@@ -1486,16 +1500,25 @@ function testStartSignInWithEmailAndPassword_upgradeAnon_nonAnon_success() {
1486
1500
asyncTestCase . waitForSignals ( 1 ) ;
1487
1501
// Simulate non-anonymous user logged in on external instance.
1488
1502
testAuth . setUser ( expectedUser ) ;
1503
+ var expectedUserCredential = {
1504
+ 'user' : expectedUser ,
1505
+ 'credential' : null ,
1506
+ 'operationType' : 'signIn' ,
1507
+ 'additionalUserInfo' : { 'providerId' : 'password' , 'isNewUser' : false }
1508
+ } ;
1489
1509
app . startSignInWithEmailAndPassword ( '[email protected] ' , 'password' )
1490
- . then ( function ( user ) {
1491
- assertEquals ( app . getAuth ( ) . currentUser , user ) ;
1510
+ . then ( function ( userCredential ) {
1511
+ assertObjectEquals ( expectedUserCredential , userCredential ) ;
1492
1512
asyncTestCase . signal ( ) ;
1493
1513
} ) ;
1494
- app . getAuth ( ) . assertSignInWithEmailAndPassword (
1514
+ app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1495
1515
[ '[email protected] ' , 'password' ] ,
1496
1516
function ( ) {
1497
1517
app . getAuth ( ) . setUser ( expectedUser ) ;
1498
- return app . getAuth ( ) . currentUser ;
1518
+ // Make a copy of expected UserCredential to ensure
1519
+ // expectedUserCredential which is used to be compared with later will
1520
+ // not be modified.
1521
+ return goog . object . clone ( expectedUserCredential ) ;
1499
1522
} ) ;
1500
1523
app . getAuth ( ) . process ( ) . then ( function ( ) {
1501
1524
// Trigger initial onAuthStateChanged listener.
@@ -1517,16 +1540,25 @@ function testStartSignInWithEmailAndPassword_upgradeAnonymous_noUser_success() {
1517
1540
asyncTestCase . waitForSignals ( 1 ) ;
1518
1541
// Simulate no user logged in on external instance.
1519
1542
testAuth . setUser ( null ) ;
1543
+ var expectedUserCredential = {
1544
+ 'user' : expectedUser ,
1545
+ 'credential' : null ,
1546
+ 'operationType' : 'signIn' ,
1547
+ 'additionalUserInfo' : { 'providerId' : 'password' , 'isNewUser' : false }
1548
+ } ;
1520
1549
app . startSignInWithEmailAndPassword ( '[email protected] ' , 'password' )
1521
- . then ( function ( user ) {
1522
- assertEquals ( app . getAuth ( ) . currentUser , user ) ;
1550
+ . then ( function ( userCredential ) {
1551
+ assertObjectEquals ( expectedUserCredential , userCredential ) ;
1523
1552
asyncTestCase . signal ( ) ;
1524
1553
} ) ;
1525
- app . getAuth ( ) . assertSignInWithEmailAndPassword (
1554
+ app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1526
1555
[ '[email protected] ' , 'password' ] ,
1527
1556
function ( ) {
1528
1557
app . getAuth ( ) . setUser ( expectedUser ) ;
1529
- return app . getAuth ( ) . currentUser ;
1558
+ // Make a copy of expected UserCredential to ensure
1559
+ // expectedUserCredential which is used to be compared with later will
1560
+ // not be modified.
1561
+ return goog . object . clone ( expectedUserCredential ) ;
1530
1562
} ) ;
1531
1563
app . getAuth ( ) . process ( ) . then ( function ( ) {
1532
1564
// Trigger initial onAuthStateChanged listener.
@@ -3768,17 +3800,26 @@ function testSignInWithExistingEmailAndPasswordForLinking_success() {
3768
3800
app . getAuth ( ) . install ( ) ;
3769
3801
app . getExternalAuth ( ) . install ( ) ;
3770
3802
asyncTestCase . waitForSignals ( 1 ) ;
3803
+ var expectedUserCredential = {
3804
+ 'user' : expectedUser ,
3805
+ 'credential' : null ,
3806
+ 'operationType' : 'signIn' ,
3807
+ 'additionalUserInfo' : { 'providerId' : 'password' , 'isNewUser' : false }
3808
+ } ;
3771
3809
app . signInWithExistingEmailAndPasswordForLinking (
3772
3810
3773
- . then ( function ( user ) {
3774
- assertEquals ( app . getAuth ( ) . currentUser , user ) ;
3811
+ . then ( function ( userCredential ) {
3812
+ assertObjectEquals ( expectedUserCredential , userCredential ) ;
3775
3813
asyncTestCase . signal ( ) ;
3776
3814
} ) ;
3777
- app . getAuth ( ) . assertSignInWithEmailAndPassword (
3815
+ app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
3778
3816
[ '[email protected] ' , 'password' ] ,
3779
3817
function ( ) {
3780
3818
app . getAuth ( ) . setUser ( expectedUser ) ;
3781
- return app . getAuth ( ) . currentUser ;
3819
+ // Make a copy of expected UserCredential to ensure
3820
+ // expectedUserCredential which is used to be compared with later will
3821
+ // not be modified.
3822
+ return goog . object . clone ( expectedUserCredential ) ;
3782
3823
} ) ;
3783
3824
app . getAuth ( ) . process ( ) ;
3784
3825
app . getExternalAuth ( ) . process ( ) ;
@@ -3802,7 +3843,7 @@ function testSignInWithExistingEmailAndPasswordForLinking_error() {
3802
3843
assertEquals ( expectedError , error ) ;
3803
3844
asyncTestCase . signal ( ) ;
3804
3845
} ) ;
3805
- app . getAuth ( ) . assertSignInWithEmailAndPassword (
3846
+ app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
3806
3847
[ '[email protected] ' , 'password' ] ,
3807
3848
null ,
3808
3849
expectedError ) ;
0 commit comments