Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix react16 tests #682

Merged
merged 1 commit into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 20 additions & 21 deletions examples/for-tests-react-16/src/AppWithReactDomRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,28 @@ import { EmailPasswordPreBuiltUI } from "supertokens-auth-react/recipe/emailpass
import { PasswordlessPreBuiltUI } from "supertokens-auth-react/recipe/passwordless/prebuiltui";
import { ThirdPartyPreBuiltUI } from "supertokens-auth-react/recipe/thirdparty/prebuiltui";

const authRecipe = window.localStorage.getItem("authRecipe") || "emailpassword";
const emailVerificationMode = window.localStorage.getItem("mode") || "OFF";
function AppWithReactDomRouter(props) {
const authRecipe = window.localStorage.getItem("authRecipe") || "emailpassword";
const emailVerificationMode = window.localStorage.getItem("mode") || "OFF";

let recipePreBuiltUIList = [EmailPasswordPreBuiltUI];
if (authRecipe === "thirdparty") {
recipePreBuiltUIList = [ThirdPartyPreBuiltUI];
} else if (authRecipe === "emailpassword") {
recipePreBuiltUIList = [EmailPasswordPreBuiltUI];
} else if (authRecipe === "both") {
recipePreBuiltUIList = [ThirdPartyPreBuiltUI, EmailPasswordPreBuiltUI];
} else if (authRecipe === "thirdpartyemailpassword") {
recipePreBuiltUIList = [ThirdPartyEmailPasswordPreBuiltUI];
} else if (authRecipe === "passwordless") {
recipePreBuiltUIList = [PasswordlessPreBuiltUI];
} else if (authRecipe === "thirdpartypasswordless") {
recipePreBuiltUIList = [ThirdPartyPasswordlessPreBuiltUI];
}
let recipePreBuiltUIList = [EmailPasswordPreBuiltUI];
if (authRecipe === "thirdparty") {
recipePreBuiltUIList = [ThirdPartyPreBuiltUI];
} else if (authRecipe === "emailpassword") {
recipePreBuiltUIList = [EmailPasswordPreBuiltUI];
} else if (authRecipe === "both") {
recipePreBuiltUIList = [EmailPasswordPreBuiltUI, ThirdPartyPreBuiltUI];
} else if (authRecipe === "thirdpartyemailpassword") {
recipePreBuiltUIList = [ThirdPartyEmailPasswordPreBuiltUI];
} else if (authRecipe === "passwordless") {
recipePreBuiltUIList = [PasswordlessPreBuiltUI];
} else if (authRecipe === "thirdpartypasswordless") {
recipePreBuiltUIList = [ThirdPartyPasswordlessPreBuiltUI];
}

if (emailVerificationMode !== "OFF") {
recipePreBuiltUIList.push(EmailVerificationPreBuiltUI);
}

function AppWithReactDomRouter(props) {
if (emailVerificationMode !== "OFF") {
recipePreBuiltUIList.push(EmailVerificationPreBuiltUI);
}
/**
* For user context tests we add this query param so the additional routes
* dont interfere with other tests
Expand Down
40 changes: 20 additions & 20 deletions examples/for-tests-react-16/src/AppWithReactDomRouterV5.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@ import { EmailPasswordPreBuiltUI } from "supertokens-auth-react/recipe/emailpass
import { PasswordlessPreBuiltUI } from "supertokens-auth-react/recipe/passwordless/prebuiltui";
import { ThirdPartyPreBuiltUI } from "supertokens-auth-react/recipe/thirdparty/prebuiltui";

const authRecipe = window.localStorage.getItem("authRecipe") || "emailpassword";
const emailVerificationMode = window.localStorage.getItem("mode") || "OFF";
function AppWithReactDomRouter(props) {
const authRecipe = window.localStorage.getItem("authRecipe") || "emailpassword";
const emailVerificationMode = window.localStorage.getItem("mode") || "OFF";

let recipePreBuiltUIList = [EmailPasswordPreBuiltUI];
if (authRecipe === "thirdparty") {
recipePreBuiltUIList = [ThirdPartyPreBuiltUI];
} else if (authRecipe === "emailpassword") {
recipePreBuiltUIList = [EmailPasswordPreBuiltUI];
} else if (authRecipe === "both") {
recipePreBuiltUIList = [EmailPasswordPreBuiltUI, ThirdPartyPreBuiltUI];
} else if (authRecipe === "thirdpartyemailpassword") {
recipePreBuiltUIList = [ThirdPartyEmailPasswordPreBuiltUI];
} else if (authRecipe === "passwordless") {
recipePreBuiltUIList = [PasswordlessPreBuiltUI];
} else if (authRecipe === "thirdpartypasswordless") {
recipePreBuiltUIList = [ThirdPartyPasswordlessPreBuiltUI];
}
if (emailVerificationMode !== "OFF") {
recipePreBuiltUIList.push(EmailVerificationPreBuiltUI);
}
let recipePreBuiltUIList = [EmailPasswordPreBuiltUI];
if (authRecipe === "thirdparty") {
recipePreBuiltUIList = [ThirdPartyPreBuiltUI];
} else if (authRecipe === "emailpassword") {
recipePreBuiltUIList = [EmailPasswordPreBuiltUI];
} else if (authRecipe === "both") {
recipePreBuiltUIList = [EmailPasswordPreBuiltUI, ThirdPartyPreBuiltUI];
} else if (authRecipe === "thirdpartyemailpassword") {
recipePreBuiltUIList = [ThirdPartyEmailPasswordPreBuiltUI];
} else if (authRecipe === "passwordless") {
recipePreBuiltUIList = [PasswordlessPreBuiltUI];
} else if (authRecipe === "thirdpartypasswordless") {
recipePreBuiltUIList = [ThirdPartyPasswordlessPreBuiltUI];
}
if (emailVerificationMode !== "OFF") {
recipePreBuiltUIList.push(EmailVerificationPreBuiltUI);
}

function AppWithReactDomRouter(props) {
return (
<div className="App">
<Router>
Expand Down
45 changes: 22 additions & 23 deletions examples/for-tests-react-16/src/AppWithoutRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,6 @@ import { PasswordlessPreBuiltUI } from "supertokens-auth-react/recipe/passwordle
import { ThirdPartyPreBuiltUI } from "supertokens-auth-react/recipe/thirdparty/prebuiltui";
import { EmailVerificationPreBuiltUI } from "supertokens-auth-react/recipe/emailverification/prebuiltui";

const authRecipe = window.localStorage.getItem("authRecipe") || "emailpassword";
const emailVerificationMode = window.localStorage.getItem("mode") || "OFF";

let recipePreBuiltUIList = [EmailPasswordPreBuiltUI];
if (authRecipe === "thirdparty") {
recipePreBuiltUIList = [ThirdPartyPreBuiltUI];
} else if (authRecipe === "emailpassword") {
recipePreBuiltUIList = [EmailPasswordPreBuiltUI];
} else if (authRecipe === "both") {
recipePreBuiltUIList = [ThirdPartyPreBuiltUI, EmailPasswordPreBuiltUI];
} else if (authRecipe === "thirdpartyemailpassword") {
recipePreBuiltUIList = [ThirdPartyEmailPasswordPreBuiltUI];
} else if (authRecipe === "passwordless") {
recipePreBuiltUIList = [PasswordlessPreBuiltUI];
} else if (authRecipe === "thirdpartypasswordless") {
recipePreBuiltUIList = [ThirdPartyPasswordlessPreBuiltUI];
}

if (emailVerificationMode !== "OFF") {
recipePreBuiltUIList.push(EmailVerificationPreBuiltUI);
}

function AppWithoutRouter() {
return (
<div className="App">
Expand All @@ -42,9 +20,30 @@ function AppWithoutRouter() {
}

function Routing() {
const [, setCurrentPath] = useState(window.location.pathname);
const authRecipe = window.localStorage.getItem("authRecipe") || "emailpassword";
const emailVerificationMode = window.localStorage.getItem("mode") || "OFF";

let recipePreBuiltUIList = [EmailPasswordPreBuiltUI];
if (authRecipe === "thirdparty") {
recipePreBuiltUIList = [ThirdPartyPreBuiltUI];
} else if (authRecipe === "emailpassword") {
recipePreBuiltUIList = [EmailPasswordPreBuiltUI];
} else if (authRecipe === "both") {
recipePreBuiltUIList = [EmailPasswordPreBuiltUI, ThirdPartyPreBuiltUI];
} else if (authRecipe === "thirdpartyemailpassword") {
recipePreBuiltUIList = [ThirdPartyEmailPasswordPreBuiltUI];
} else if (authRecipe === "passwordless") {
recipePreBuiltUIList = [PasswordlessPreBuiltUI];
} else if (authRecipe === "thirdpartypasswordless") {
recipePreBuiltUIList = [ThirdPartyPasswordlessPreBuiltUI];
}

if (emailVerificationMode !== "OFF") {
recipePreBuiltUIList.push(EmailVerificationPreBuiltUI);
}

const [, setCurrentPath] = useState(window.location.pathname);

useEffect(() => {
const onLocationChange = () => {
setCurrentPath(window.location.pathname);
Expand Down
41 changes: 21 additions & 20 deletions examples/for-tests/src/AppWithoutRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,30 @@ function AppWithoutRouter() {
</div>
);
}
const authRecipe = window.localStorage.getItem("authRecipe") || "emailpassword";
const emailVerificationMode = window.localStorage.getItem("mode") || "OFF";

let recipePreBuiltUIList = [EmailPasswordPreBuiltUI];
if (authRecipe === "thirdparty") {
recipePreBuiltUIList = [ThirdPartyPreBuiltUI];
} else if (authRecipe === "emailpassword") {
recipePreBuiltUIList = [EmailPasswordPreBuiltUI];
} else if (authRecipe === "both") {
recipePreBuiltUIList = [ThirdPartyPreBuiltUI, EmailPasswordPreBuiltUI];
} else if (authRecipe === "thirdpartyemailpassword") {
recipePreBuiltUIList = [ThirdPartyEmailPasswordPreBuiltUI];
} else if (authRecipe === "passwordless") {
recipePreBuiltUIList = [PasswordlessPreBuiltUI];
} else if (authRecipe === "thirdpartypasswordless") {
recipePreBuiltUIList = [ThirdPartyPasswordlessPreBuiltUI];
}
function Routing() {
const authRecipe = window.localStorage.getItem("authRecipe") || "emailpassword";
const emailVerificationMode = window.localStorage.getItem("mode") || "OFF";

if (emailVerificationMode !== "OFF") {
recipePreBuiltUIList.push(EmailVerificationPreBuiltUI);
}
let recipePreBuiltUIList = [EmailPasswordPreBuiltUI];
if (authRecipe === "thirdparty") {
recipePreBuiltUIList = [ThirdPartyPreBuiltUI];
} else if (authRecipe === "emailpassword") {
recipePreBuiltUIList = [EmailPasswordPreBuiltUI];
} else if (authRecipe === "both") {
recipePreBuiltUIList = [EmailPasswordPreBuiltUI, ThirdPartyPreBuiltUI];
} else if (authRecipe === "thirdpartyemailpassword") {
recipePreBuiltUIList = [ThirdPartyEmailPasswordPreBuiltUI];
} else if (authRecipe === "passwordless") {
recipePreBuiltUIList = [PasswordlessPreBuiltUI];
} else if (authRecipe === "thirdpartypasswordless") {
recipePreBuiltUIList = [ThirdPartyPasswordlessPreBuiltUI];
}

if (emailVerificationMode !== "OFF") {
recipePreBuiltUIList.push(EmailVerificationPreBuiltUI);
}

function Routing() {
const [, setCurrentPath] = useState(window.location.pathname);

useEffect(() => {
Expand Down