@@ -1661,7 +1661,7 @@ function testAuth_onAuthStateChanged() {
1661
1661
* Test whether we can retrieve the signed-in user as a promise.
1662
1662
* We also verify the behavior when user signs out.
1663
1663
*/
1664
- function testAuth_getSignedInUser ( ) {
1664
+ function testAuth_getSignedInUser_success ( ) {
1665
1665
stubs . reset ( ) ;
1666
1666
var expectedTokenResponse2 = {
1667
1667
'idToken' : jwt2 ,
@@ -1748,6 +1748,30 @@ function testAuth_getSignedInUser() {
1748
1748
asyncTestCase . waitForSignals ( 1 ) ;
1749
1749
}
1750
1750
1751
+ function testAuth_getSignedInUser_error ( ) {
1752
+ stubs . reset ( ) ;
1753
+ var expectedError = new fireauth . AuthError (
1754
+ fireauth . authenum . Error . INTERNAL_ERROR ) ;
1755
+ // throw when onAuthStateChanged is called
1756
+ stubs . replace (
1757
+ fireauth . Auth . prototype ,
1758
+ 'onAuthStateChanged' ,
1759
+ function ( tokenResponse ) {
1760
+ throw expectedError ;
1761
+ } ) ;
1762
+ app1 = firebase . initializeApp ( config1 , appId1 ) ;
1763
+ auth1 = app1 . auth ( ) ;
1764
+ auth1 . getSignedInUser ( )
1765
+ . then ( ( signedInUser ) => {
1766
+ fail ( 'getSignedInUser should not resolve!' ) ;
1767
+ } )
1768
+ . catch ( function ( error ) {
1769
+ fireauth . common . testHelper . assertErrorEquals ( expectedError , error ) ;
1770
+ asyncTestCase . signal ( ) ;
1771
+ } ) ;
1772
+ mockControl . $replayAll ( ) ;
1773
+ asyncTestCase . waitForSignals ( 1 ) ;
1774
+ }
1751
1775
1752
1776
function testFetchSignInMethodsForEmail ( ) {
1753
1777
0 commit comments