diff --git a/lib/build/multifactorauth-shared.js b/lib/build/multifactorauth-shared.js index 99bac04b4..5618818b5 100644 --- a/lib/build/multifactorauth-shared.js +++ b/lib/build/multifactorauth-shared.js @@ -378,6 +378,16 @@ var MultiFactorAuth = /** @class */ (function (_super) { }); }); }; + /* + * Tests methods. + */ + MultiFactorAuth.reset = function () { + if (!genericComponentOverrideContext.isTest()) { + return; + } + MultiFactorAuth.instance = undefined; + return; + }; var _a; _a = MultiFactorAuth; MultiFactorAuth.RECIPE_ID = "multifactorauth"; diff --git a/lib/build/recipe/multifactorauth/recipe.d.ts b/lib/build/recipe/multifactorauth/recipe.d.ts index 55556b1dd..14b5a0bba 100644 --- a/lib/build/recipe/multifactorauth/recipe.d.ts +++ b/lib/build/recipe/multifactorauth/recipe.d.ts @@ -37,4 +37,5 @@ export default class MultiFactorAuth extends RecipeModule< getSecondaryFactors(): SecondaryFactorRedirectionInfo[]; redirectToFactor(factorId: string, redirectBack?: boolean, history?: any): Promise; redirectToFactorChooser(redirectBack?: boolean, history?: any): Promise; + static reset(): void; } diff --git a/lib/ts/recipe/multifactorauth/recipe.tsx b/lib/ts/recipe/multifactorauth/recipe.tsx index 5c267c3e8..58a80806c 100644 --- a/lib/ts/recipe/multifactorauth/recipe.tsx +++ b/lib/ts/recipe/multifactorauth/recipe.tsx @@ -24,7 +24,7 @@ import { SessionClaimValidatorStore } from "supertokens-web-js/utils/sessionClai import { SSR_ERROR } from "../../constants"; import SuperTokens from "../../superTokens"; -import { appendQueryParamsToURL, getCurrentNormalisedUrlPath, getRedirectToPathFromURL } from "../../utils"; +import { appendQueryParamsToURL, getCurrentNormalisedUrlPath, getRedirectToPathFromURL, isTest } from "../../utils"; import RecipeModule from "../recipeModule"; import { DEFAULT_FACTOR_CHOOSER_PATH } from "./constants"; @@ -188,4 +188,16 @@ export default class MultiFactorAuth extends RecipeModule< } return SuperTokens.getInstanceOrThrow().redirectToUrl(url, history); } + + /* + * Tests methods. + */ + static reset(): void { + if (!isTest()) { + return; + } + + MultiFactorAuth.instance = undefined; + return; + } }