test(supabase): TOTP step guard in the sandbox verify helper

This commit is contained in:
bchanot committed 2026-11-04 18:55:47 +01:00
1 parent 697cefa2dd
commit 2b10471b0a
4 files changed
+39 -34

No files matched your search

+5 -2
View File
@@ -12,6 +12,7 @@ import type { Dict } from '@/i18n/types'
import type { Browser, BrowserContext, Page } from '@playwright/test'
import {
enrolTotp,
refusal,
verifyTotp,
} from '../../../../packages/supabase/tests/sandbox/mfa'
import {
@@ -50,10 +51,12 @@ export async function makeActor(
for (const kind of grants) await seedGrant(account, kind)
const token = await passwordToken(account)
const enrolment = await enrolTotp(token, 'Téléphone')
if (!enrolment.factor) throw new Error('editor fixture: enrol refused')
if (!enrolment.factor)
throw new Error(`editor fixture: enrol ${refusal(enrolment)}`)
const verified = await verifyTotp(token, enrolment.factor)
const aal2 = verified.body.access_token
if (typeof aal2 !== 'string') throw new Error('editor fixture: no aal2')
if (typeof aal2 !== 'string')
throw new Error(`editor fixture: no aal2 ${refusal(verified)}`)
return { account, secret: enrolment.factor.secret, aal2 }
}