Skip to content

Commit 4ebae0a

Browse files
committed
fixed test cases to handle async signin
1 parent 814a39e commit 4ebae0a

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

packages/auth/src/mfa/assertions/totp.test.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import { AuthErrorCode } from '../../core/errors';
3838
import { AppName } from '../../model/auth';
3939
import { _castAuth } from '../../core/auth/auth_impl';
4040
import { MultiFactorAssertionImpl } from '../mfa_assertion';
41-
import { FirebaseError } from '@firebase/util';
4241

4342
use(chaiAsPromised);
4443

@@ -268,12 +267,9 @@ describe('Testing signin Flow', () => {
268267
'123456'
269268
) as any;
270269

271-
try {
272-
_response = await assertion._process(auth, session);
273-
} catch (e) {
274-
expect(e).to.be.an.instanceOf(FirebaseError);
275-
expect(e.message).to.eql('Firebase: Error (auth/argument-error).');
276-
}
270+
await expect(assertion._process(auth, session)).to.be.rejectedWith(
271+
'auth/argument-error'
272+
);
277273
});
278274

279275
it('should throw Firebase Error if otp is undefined', async () => {
@@ -288,12 +284,9 @@ describe('Testing signin Flow', () => {
288284
undefined as any
289285
) as any;
290286

291-
try {
292-
_response = await assertion._process(auth, session);
293-
} catch (e) {
294-
expect(e).to.be.an.instanceOf(FirebaseError);
295-
expect(e.message).to.eql('Firebase: Error (auth/argument-error).');
296-
}
287+
await expect(assertion._process(auth, session)).to.be.rejectedWith(
288+
'auth/argument-error'
289+
);
297290
});
298291
});
299292

0 commit comments

Comments
 (0)