Skip to content

Commit ebc8fc1

Browse files
committed
Fix tests
1 parent 097c031 commit ebc8fc1

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

apps/backend/src/app/health/email/route.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const waitForVerificationEmail = async (testEmail: string, useInbucket: boolean)
107107
const POLL_INTERVAL_MS = 5000;
108108

109109
for (let attempt = 1; attempt <= MAX_POLL_ATTEMPTS; attempt++) {
110-
await traceSpan(`waiting for verification email - attempt ${attempt}`, async () => {
110+
const done = await traceSpan(`waiting for verification email - attempt ${attempt}`, async () => {
111111
await wait(POLL_INTERVAL_MS);
112112

113113
const listData = useInbucket
@@ -118,9 +118,14 @@ const waitForVerificationEmail = async (testEmail: string, useInbucket: boolean)
118118
const verificationEmail = emails.find((email) => isExpectedVerificationEmail(email, testEmail));
119119

120120
if (verificationEmail) {
121-
return;
121+
return true;
122122
}
123+
124+
return false;
123125
});
126+
if (done) {
127+
return;
128+
}
124129
}
125130

126131
throw new StackAssertionError(`Couldn't find verification email in time limit`, { recipient_email: testEmail, max_poll_attempts: MAX_POLL_ATTEMPTS, poll_interval_ms: POLL_INTERVAL_MS });

0 commit comments

Comments
 (0)