1
- import { expect , use } from 'chai' ;
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import { expect , use } from 'chai' ;
2
19
import * as sinonChai from 'sinon-chai' ;
3
20
import * as sinon from 'sinon' ;
4
21
import * as exp from '@firebase/auth-exp/internal' ;
@@ -25,8 +42,12 @@ describe('popup_redirect/CompatPopupRedirectResolver', () => {
25
42
} ) ;
26
43
27
44
context ( 'initialization and resolver selection' , ( ) => {
28
- const browserResolver = exp . _getInstance < exp . PopupRedirectResolverInternal > ( exp . browserPopupRedirectResolver ) ;
29
- const cordovaResolver = exp . _getInstance < exp . PopupRedirectResolverInternal > ( exp . cordovaPopupRedirectResolver ) ;
45
+ const browserResolver = exp . _getInstance < exp . PopupRedirectResolverInternal > (
46
+ exp . browserPopupRedirectResolver
47
+ ) ;
48
+ const cordovaResolver = exp . _getInstance < exp . PopupRedirectResolverInternal > (
49
+ exp . cordovaPopupRedirectResolver
50
+ ) ;
30
51
31
52
beforeEach ( ( ) => {
32
53
sinon . stub ( browserResolver , '_initialize' ) ;
@@ -54,29 +75,55 @@ describe('popup_redirect/CompatPopupRedirectResolver', () => {
54
75
55
76
beforeEach ( ( ) => {
56
77
underlyingResolver = sinon . createStubInstance ( FakeResolver ) ;
57
- ( compatResolver as unknown as { underlyingResolver : exp . PopupRedirectResolverInternal } ) . underlyingResolver = underlyingResolver ;
78
+ ( ( compatResolver as unknown ) as {
79
+ underlyingResolver : exp . PopupRedirectResolverInternal ;
80
+ } ) . underlyingResolver = underlyingResolver ;
58
81
provider = new exp . GoogleAuthProvider ( ) ;
59
82
} ) ;
60
83
61
84
it ( '_openPopup' , async ( ) => {
62
- await compatResolver . _openPopup ( auth , provider , exp . AuthEventType . LINK_VIA_POPUP , 'eventId' ) ;
63
- expect ( underlyingResolver . _openPopup ) . to . have . been . calledWith ( auth , provider , exp . AuthEventType . LINK_VIA_POPUP , 'eventId' ) ;
85
+ await compatResolver . _openPopup (
86
+ auth ,
87
+ provider ,
88
+ exp . AuthEventType . LINK_VIA_POPUP ,
89
+ 'eventId'
90
+ ) ;
91
+ expect ( underlyingResolver . _openPopup ) . to . have . been . calledWith (
92
+ auth ,
93
+ provider ,
94
+ exp . AuthEventType . LINK_VIA_POPUP ,
95
+ 'eventId'
96
+ ) ;
64
97
} ) ;
65
98
66
99
it ( '_openRedirect' , async ( ) => {
67
- await compatResolver . _openRedirect ( auth , provider , exp . AuthEventType . LINK_VIA_REDIRECT , 'eventId' ) ;
68
- expect ( underlyingResolver . _openRedirect ) . to . have . been . calledWith ( auth , provider , exp . AuthEventType . LINK_VIA_REDIRECT , 'eventId' ) ;
100
+ await compatResolver . _openRedirect (
101
+ auth ,
102
+ provider ,
103
+ exp . AuthEventType . LINK_VIA_REDIRECT ,
104
+ 'eventId'
105
+ ) ;
106
+ expect ( underlyingResolver . _openRedirect ) . to . have . been . calledWith (
107
+ auth ,
108
+ provider ,
109
+ exp . AuthEventType . LINK_VIA_REDIRECT ,
110
+ 'eventId'
111
+ ) ;
69
112
} ) ;
70
113
71
114
it ( '_isIframeWebStorageSupported' , ( ) => {
72
115
const cb = ( ) : void => { } ;
73
116
compatResolver . _isIframeWebStorageSupported ( auth , cb ) ;
74
- expect ( underlyingResolver . _isIframeWebStorageSupported ) . to . have . been . calledWith ( auth , cb ) ;
117
+ expect (
118
+ underlyingResolver . _isIframeWebStorageSupported
119
+ ) . to . have . been . calledWith ( auth , cb ) ;
75
120
} ) ;
76
121
77
122
it ( '_originValidation' , async ( ) => {
78
123
await compatResolver . _originValidation ( auth ) ;
79
- expect ( underlyingResolver . _originValidation ) . to . have . been . calledWith ( auth ) ;
124
+ expect ( underlyingResolver . _originValidation ) . to . have . been . calledWith (
125
+ auth
126
+ ) ;
80
127
} ) ;
81
128
} ) ;
82
129
} ) ;
0 commit comments