mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 12:03:17 +00:00
tests
This commit is contained in:
@@ -4,7 +4,10 @@ describe("register", () => {
|
||||
beforeEach(() => {
|
||||
stub("zitadel.org.v2.OrganizationService", "ListOrganizations", {
|
||||
data: {
|
||||
result: [{ id: "123" }],
|
||||
details: {
|
||||
totalResult: 1,
|
||||
},
|
||||
result: [{ id: "256088834543534543" }],
|
||||
},
|
||||
});
|
||||
stub("zitadel.user.v2.UserService", "AddHumanUser", {
|
||||
|
||||
@@ -1,42 +1,62 @@
|
||||
import { stub } from "../support/mock";
|
||||
|
||||
describe("/verify", () => {
|
||||
it("shows authenticators after successful invite verification", () => {
|
||||
stub("zitadel.user.v2.UserService", "VerifyInviteCode");
|
||||
cy.visit("/verify?userId=123&code=abc&submit=true&invite=true");
|
||||
cy.location("pathname", { timeout: 10000 }).should(
|
||||
"eq",
|
||||
"/authenticator/set",
|
||||
);
|
||||
});
|
||||
it("shows an error if invite code validation failed", () => {
|
||||
stub("zitadel.user.v2.UserService", "VerifyInviteCode", {
|
||||
code: 3,
|
||||
error: "error validating code",
|
||||
});
|
||||
// TODO: Avoid uncaught exception in application
|
||||
cy.once("uncaught:exception", () => false);
|
||||
cy.visit("/verify?userId=123&code=abc&submit=true&invite=true");
|
||||
cy.contains("Could not verify invite", { timeout: 10000 });
|
||||
beforeEach(() => {
|
||||
stub("zitadel.org.v2.OrganizationService", "ListOrganizations", {
|
||||
data: {
|
||||
details: {
|
||||
totalResult: 1,
|
||||
},
|
||||
result: [{ id: "256088834543534543" }],
|
||||
},
|
||||
});
|
||||
|
||||
it("shows password and passkey method after successful invite verification", () => {
|
||||
stub("zitadel.user.v2.UserService", "VerifyEmail");
|
||||
cy.visit("/verify?userId=123&code=abc&submit=true");
|
||||
cy.location("pathname", { timeout: 10000 }).should(
|
||||
"eq",
|
||||
"/authenticator/set",
|
||||
);
|
||||
stub("zitadel.user.v2.UserService", "ListAuthenticationMethodTypes", {
|
||||
data: {
|
||||
authMethodTypes: [],
|
||||
},
|
||||
});
|
||||
|
||||
it("shows an error if invite code validation failed", () => {
|
||||
stub("zitadel.user.v2.UserService", "VerifyEmail", {
|
||||
code: 3,
|
||||
error: "error validating code",
|
||||
describe("verify invite", () => {
|
||||
it.only("shows authenticators after successful invite verification", () => {
|
||||
stub("zitadel.user.v2.UserService", "VerifyInviteCode");
|
||||
cy.visit("/verify?userId=123&code=abc&invite=true");
|
||||
cy.location("pathname", { timeout: 10_000 }).should(
|
||||
"eq",
|
||||
"/authenticator/set",
|
||||
);
|
||||
});
|
||||
|
||||
it("shows an error if invite code validation failed", () => {
|
||||
stub("zitadel.user.v2.UserService", "VerifyInviteCode", {
|
||||
code: 3,
|
||||
error: "error validating code",
|
||||
});
|
||||
// TODO: Avoid uncaught exception in application
|
||||
cy.once("uncaught:exception", () => false);
|
||||
cy.visit("/verify?userId=123&code=abc&invite=true");
|
||||
cy.contains("Could not verify invite", { timeout: 10_000 });
|
||||
});
|
||||
});
|
||||
|
||||
describe("verify email", () => {
|
||||
it("shows password and passkey method after successful invite verification", () => {
|
||||
stub("zitadel.user.v2.UserService", "VerifyEmail");
|
||||
cy.visit("/verify?userId=123&code=abc");
|
||||
cy.location("pathname", { timeout: 10_000 }).should(
|
||||
"eq",
|
||||
"/authenticator/set",
|
||||
);
|
||||
});
|
||||
|
||||
it("shows an error if invite code validation failed", () => {
|
||||
stub("zitadel.user.v2.UserService", "VerifyEmail", {
|
||||
code: 3,
|
||||
error: "error validating code",
|
||||
});
|
||||
// TODO: Avoid uncaught exception in application
|
||||
cy.once("uncaught:exception", () => false);
|
||||
cy.visit("/verify?userId=123&code=abc&submit=true");
|
||||
cy.contains("Could not verify email", { timeout: 10_000 });
|
||||
});
|
||||
// TODO: Avoid uncaught exception in application
|
||||
cy.once("uncaught:exception", () => false);
|
||||
cy.visit("/verify?userId=123&code=abc&submit=true");
|
||||
cy.contains("Could not verify email", { timeout: 10000 });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
getLegalAndSupportSettings,
|
||||
getPasswordComplexitySettings,
|
||||
} from "@/lib/zitadel";
|
||||
import { Organization } from "@zitadel/proto/zitadel/org/v2/org_pb";
|
||||
import { getLocale, getTranslations } from "next-intl/server";
|
||||
|
||||
export default async function Page({
|
||||
@@ -21,11 +22,16 @@ export default async function Page({
|
||||
searchParams;
|
||||
|
||||
if (!organization) {
|
||||
const org = await getDefaultOrg();
|
||||
const org: Organization | void = await getDefaultOrg().catch((error) => {
|
||||
console.log("err");
|
||||
});
|
||||
if (!org) {
|
||||
console.log("no default organization");
|
||||
throw new Error("No default organization found");
|
||||
}
|
||||
|
||||
console.log("org", org);
|
||||
|
||||
organization = org.id;
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,10 @@ export function RegisterFormWithoutPassword({
|
||||
variant={ButtonVariants.Primary}
|
||||
disabled={loading || !formState.isValid || !tosAndPolicyAccepted}
|
||||
onClick={handleSubmit((values) =>
|
||||
submitAndContinue(values, selected === methods[0] ? false : true),
|
||||
submitAndContinue(
|
||||
values,
|
||||
selected.name === methods[0].name ? false : true,
|
||||
),
|
||||
)}
|
||||
>
|
||||
{loading && <Spinner className="h-5 w-5 mr-2" />}
|
||||
|
||||
Reference in New Issue
Block a user