@auth0/nextjs-auth0
Version:
Auth0 Next.js SDK
52 lines (51 loc) • 1.64 kB
TypeScript
/**
* Shared MFA test scenarios for flow tests.
* Reduces duplication between client and server test suites.
*/
import type { MfaRequirements } from "../errors/index.js";
import type { Authenticator, ChallengeResponse, EnrollmentResponse, MfaVerifyResponse } from "../types/index.js";
/**
* Test scenario structure for black-box testing.
*/
export interface MfaTestScenario<TInput = any, TOutput = any> {
/** Test case name */
name: string;
/** Input parameters */
input: TInput;
/** Expected output or validation function */
expected?: TOutput | ((result: TOutput) => void);
/** MSW response configuration */
mswResponse?: {
status: number;
body: any;
};
/** Expected error validation */
expectError?: (error: any) => void;
}
export declare const getAuthenticatorsScenarios: MfaTestScenario<{
mfaToken: string;
mfaRequirements?: MfaRequirements;
}, Authenticator[]>[];
export declare const challengeScenarios: MfaTestScenario<{
mfaToken: string;
challengeType: string;
authenticatorId?: string;
mfaRequirements?: MfaRequirements;
}, ChallengeResponse>[];
export declare const verifyScenarios: MfaTestScenario<{
mfaToken: string;
otp?: string;
oobCode?: string;
bindingCode?: string;
recoveryCode?: string;
audience?: string;
scope?: string;
mfaRequirements?: MfaRequirements;
}, MfaVerifyResponse>[];
export declare const enrollScenarios: MfaTestScenario<{
mfaToken: string;
authenticatorTypes: string[];
oobChannels?: string[];
phoneNumber?: string;
email?: string;
}, EnrollmentResponse>[];