Skip to content

Commit 10aa3f1

Browse files
committed
changed test email and fixed handling of user delete for totp
1 parent 9c054b5 commit 10aa3f1

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

packages/auth/test/helpers/integration/helpers.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,12 @@ export function getTestInstance(requireEmulator = false): Auth {
6666
} else {
6767
// Clear out any new users that were created in the course of the test
6868
for (const user of createdUsers) {
69-
try {
70-
await user.delete();
71-
} catch {
72-
// Best effort. Maybe the test already deleted the user ¯\_(ツ)_/¯
69+
if (!user.email?.includes('donotdelete')) {
70+
try {
71+
await user.delete();
72+
} catch {
73+
// Best effort. Maybe the test already deleted the user ¯\_(ツ)_/¯
74+
}
7375
}
7476
}
7577
}
@@ -127,4 +129,5 @@ export function delay(dt: number): Promise<void> {
127129
return new Promise(resolve => setTimeout(resolve, dt));
128130
}
129131

130-
export const email = '[email protected]';
132+
export const email = '[email protected]';
133+
export const incorrectTotpCode = '1000000';

packages/auth/test/integration/flows/totp.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ import {
3030
getTestInstance,
3131
getTotpCode,
3232
delay,
33-
email
33+
email,
34+
incorrectTotpCode
3435
} from '../../helpers/integration/helpers';
3536

3637
import {
@@ -59,7 +60,6 @@ describe(' Integration tests: Mfa TOTP', () => {
5960
const mfaUser = multiFactor(cr.user);
6061
const session = await mfaUser.getSession();
6162
totpSecret = await TotpMultiFactorGenerator.generateSecret(session);
62-
const incorrectTotpCode = '1000000';
6363
const multiFactorAssertion =
6464
TotpMultiFactorGenerator.assertionForEnrollment(
6565
totpSecret,
@@ -108,7 +108,7 @@ describe(' Integration tests: Mfa TOTP', () => {
108108

109109
resolver = getMultiFactorResolver(auth, error as any);
110110
expect(resolver.hints).to.have.length(1);
111-
const incorrectTotpCode = '1000000';
111+
112112
const assertion = TotpMultiFactorGenerator.assertionForSignIn(
113113
resolver.hints[0].uid,
114114
incorrectTotpCode
@@ -152,5 +152,5 @@ describe(' Integration tests: Mfa TOTP', () => {
152152

153153
await expect(mfaUser.unenroll(resolver.hints[0].uid)).to.be.fulfilled;
154154
}
155-
}).timeout(31000);
155+
}).timeout(32000);
156156
});

0 commit comments

Comments
 (0)