@@ -583,15 +583,16 @@ const post = (manager: AuthManager, path: string, body: unknown, headers: Record
583583 * A member of an organization that requires MFA, unenrolled, whose grace clock
584584 * started 30 days ago, in a session whose active organization is that one —
585585 * the card's measured state, on a deployment with two-factor on or off, and a
586- * grace period of `graceDays` (7 unless a case says otherwise).
586+ * grace period of `graceDays` (7 unless a case says otherwise; `null` configures
587+ * none, so the manager's own default applies).
587588 */
588- async function arrangeHeldMember ( twoFactor : boolean , graceDays : number | undefined = 7 ) {
589+ async function arrangeHeldMember ( twoFactor : boolean , graceDays : number | null = 7 ) {
589590 const engine : any = createMemoryEngine ( ) ;
590591 const manager = new AuthManager ( {
591592 secret : SECRET ,
592593 baseUrl : 'http://localhost:3000' ,
593594 dataEngine : engine ,
594- ...( graceDays === undefined ? { } : { mfaGracePeriodDays : graceDays } ) ,
595+ ...( graceDays === null ? { } : { mfaGracePeriodDays : graceDays } ) ,
595596 ...( twoFactor ? { plugins : { twoFactor : true } } : { } ) ,
596597 } as any ) ;
597598 const signedUp = await post ( manager , '/sign-up/email' , { email : EMAIL , password : PASSWORD , name : 'Member' } ) ;
@@ -653,8 +654,8 @@ describe('#30411 the grace period the notice names is the one the gate holds to'
653654 } ) ;
654655
655656 it . each ( [
656- [ 40 , false ] , [ 20 , true ] , [ undefined , true ] ,
657- ] as const ) ( 'grace %j days, clock started 30 days ago: held = %j, and the manager answers the same number' , async ( graceDays , held ) => {
657+ [ 40 , false ] , [ 20 , true ] , [ null , true ] ,
658+ ] as const ) ( 'grace %j days (null: unset) , clock started 30 days ago: held = %j, and the manager answers the same number' , async ( graceDays , held ) => {
658659 const { manager, userId } = await arrangeHeldMember ( true , graceDays ) ;
659660 expect ( manager . getMfaGracePeriodDays ( ) ) . toBe ( graceDays ?? 7 ) ;
660661 const gates = await manager . resolveUserAuthGates ( userId , { organizationId : ORG } ) ;
0 commit comments