Skip to content

Commit

Permalink
test: add reset method to mfa recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus committed Nov 9, 2023
1 parent 46ae327 commit 150c9ad
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/build/multifactorauth-shared.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/build/recipe/multifactorauth/recipe.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion lib/ts/recipe/multifactorauth/recipe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { SessionClaimValidatorStore } from "supertokens-web-js/utils/sessionClai

import { SSR_ERROR } from "../../constants";
import SuperTokens from "../../superTokens";
import { getCurrentNormalisedUrlPath, getRedirectToPathFromURL } from "../../utils";
import { getCurrentNormalisedUrlPath, getRedirectToPathFromURL, isTest } from "../../utils";
import RecipeModule from "../recipeModule";

import { DEFAULT_FACTOR_CHOOSER_PATH } from "./constants";
Expand Down Expand Up @@ -193,4 +193,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;
}
}

0 comments on commit 150c9ad

Please sign in to comment.