@@ -24,10 +24,7 @@ import * as mockFetch from '../../../test/helpers/mock_fetch';
24
24
import { Endpoint } from '../../api' ;
25
25
import { MultiFactorSessionImpl } from '../../mfa/mfa_session' ;
26
26
import { StartTotpMfaEnrollmentResponse } from '../../api/account_management/mfa' ;
27
- import {
28
- FinalizeMfaResponse ,
29
- StartTotpMfaSignInResponse
30
- } from '../../api/authentication/mfa' ;
27
+ import { FinalizeMfaResponse } from '../../api/authentication/mfa' ;
31
28
import {
32
29
TotpMultiFactorAssertionImpl ,
33
30
TotpMultiFactorGenerator ,
@@ -215,7 +212,6 @@ describe('core/mfa/totp/assertions/TotpMultiFactorAssertionImpl', () => {
215
212
describe ( 'Testing signin Flow' , ( ) => {
216
213
let auth : TestAuth ;
217
214
let assertion : MultiFactorAssertionImpl ;
218
- let totpSignInResponse : StartTotpMfaSignInResponse ;
219
215
let session : MultiFactorSessionImpl ;
220
216
beforeEach ( async ( ) => {
221
217
mockFetch . setUp ( ) ;
@@ -227,24 +223,18 @@ describe('Testing signin Flow', () => {
227
223
afterEach ( mockFetch . tearDown ) ;
228
224
229
225
it ( 'should finalize mfa signin for totp' , async ( ) => {
230
- totpSignInResponse = {
231
- verificationCode : '123456' ,
226
+ const mockResponse : FinalizeMfaResponse = {
232
227
idToken : 'final-id-token' ,
233
228
refreshToken : 'refresh-token'
234
- } as any ;
229
+ } ;
230
+ const mock = mockEndpoint ( Endpoint . FINALIZE_MFA_SIGN_IN , mockResponse ) ;
235
231
assertion = TotpMultiFactorGenerator . assertionForSignIn (
236
232
'enrollment-id' ,
237
233
'123456'
238
234
) as any ;
239
-
240
- const mock = mockEndpoint (
241
- Endpoint . FINALIZE_MFA_SIGN_IN ,
242
- totpSignInResponse
243
- ) ;
244
-
245
235
const response = await assertion . _process ( auth , session ) ;
246
236
247
- expect ( response ) . to . eql ( totpSignInResponse ) ;
237
+ expect ( response ) . to . eql ( mockResponse ) ;
248
238
249
239
expect ( mock . calls [ 0 ] . request ) . to . eql ( {
250
240
mfaPendingCredential : 'mfa-pending-credential' ,
@@ -256,12 +246,6 @@ describe('Testing signin Flow', () => {
256
246
} ) ;
257
247
258
248
it ( 'should throw Firebase Error if enrollment-id is undefined' , async ( ) => {
259
- let _response : FinalizeMfaResponse ;
260
- totpSignInResponse = {
261
- verificationCode : '123456' ,
262
- idToken : 'final-id-token' ,
263
- refreshToken : 'refresh-token'
264
- } as any ;
265
249
assertion = TotpMultiFactorGenerator . assertionForSignIn (
266
250
undefined as any ,
267
251
'123456'
@@ -273,12 +257,6 @@ describe('Testing signin Flow', () => {
273
257
} ) ;
274
258
275
259
it ( 'should throw Firebase Error if otp is undefined' , async ( ) => {
276
- let _response : FinalizeMfaResponse ;
277
- totpSignInResponse = {
278
- verificationCode : '123456' ,
279
- idToken : 'final-id-token' ,
280
- refreshToken : 'refresh-token'
281
- } as any ;
282
260
assertion = TotpMultiFactorGenerator . assertionForSignIn (
283
261
'enrollment-id' ,
284
262
undefined as any
0 commit comments