* feat: redirect to new onboarding flow * Getting started * Brand details * Preview organization brands * Orgs team pages * Invite team steps * Move to global zustand store * Few darkmdoe fixes * Wip onboarding + stripe flow * Default plan state Server Action for gettting slug satus of org * Remove onboardingId * Confirmation prompt * Update old onboarding flow handlers to handle new fields * update onboarding hook * Filter out organization section for none -company emails * Match placeholders to users domain * Drop migration * Wip new onboarding intent * WIP flow for self-hosted. Same service call just split logic * WIP * Add TODO * Use onboarding user type instead of trpc session * WIP * WIP * pass role and team name from onboarding to save in schema * Add test to ensure role + name + team are persisted into onboarding table * migrate roles to enum values * Update ENUM * Fix type error * Redirect if flag is disabled * Remove web * WIP * WIP * Fix migration * Fix calls * User onboarding User types instead of trpc session * Fix factory tests * Fix flow for self hoste * Type error * More type fixes * Fix handler tests * Fix enum return type being different * Use consistant types across the oganization stuff * Fix * Use TEAM_BILLING for e2e test * Refactor is not company email and add tests * Fix * Fix * Refactor flow to submit after form complete * Fix flow with billing disabled * Fix tests * Apply suggestion from @coderabbitai[bot] Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Rename and move test files * WIP * Fix types * Update repo paths + tests * Move to service folder * Fix tests * Fix types * Remove old test files * Restore lock * Fix path * Fix tests with new paths and factory logic * Fix updaetdAt * WIP onboardingID isolation * Fix e2e test * verify test * Code rabbit * Rename SelfHostedOnboardongService -> SelfHostedOrganizationOnboardingService * Fix stores * Fix type error * Fix types * remove tsignore * Apply suggestion from @coderabbitai[bot] Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * NITS * Add the logic to auto complete admin org when billing enabled * Fix store being weird * We need to return the parsed value * fixes * sync from db always * Add onboardingSgtore tests * fix test * remove step and status --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
117 lines
3.2 KiB
TypeScript
117 lines
3.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { isNotACompanyEmail } from "./orgCreationUtils";
|
|
|
|
describe("orgCreationUtils", () => {
|
|
describe("isNotACompanyEmail", () => {
|
|
it("should return true for gmail.com email", () => {
|
|
expect(isNotACompanyEmail("user@gmail.com")).toBe(true);
|
|
});
|
|
|
|
it("should return true for yahoo.com email", () => {
|
|
expect(isNotACompanyEmail("user@yahoo.com")).toBe(true);
|
|
});
|
|
|
|
it("should return true for outlook.com email", () => {
|
|
expect(isNotACompanyEmail("user@outlook.com")).toBe(true);
|
|
});
|
|
|
|
it("should return true for hotmail.com email", () => {
|
|
expect(isNotACompanyEmail("user@hotmail.com")).toBe(true);
|
|
});
|
|
|
|
it("should return true for protonmail.com email", () => {
|
|
expect(isNotACompanyEmail("user@protonmail.com")).toBe(true);
|
|
});
|
|
|
|
it("should return true for proton.me email", () => {
|
|
expect(isNotACompanyEmail("user@proton.me")).toBe(true);
|
|
});
|
|
|
|
it("should return true for icloud.com email", () => {
|
|
expect(isNotACompanyEmail("user@icloud.com")).toBe(true);
|
|
});
|
|
|
|
it("should return true for live.com email", () => {
|
|
expect(isNotACompanyEmail("user@live.com")).toBe(true);
|
|
});
|
|
|
|
it("should return false for company email", () => {
|
|
expect(isNotACompanyEmail("user@company.com")).toBe(false);
|
|
});
|
|
|
|
it("should return false for company email with subdomain", () => {
|
|
expect(isNotACompanyEmail("user@mail.company.com")).toBe(false);
|
|
});
|
|
|
|
it("should return false for company email with country code", () => {
|
|
expect(isNotACompanyEmail("user@company.co.uk")).toBe(false);
|
|
});
|
|
|
|
it("should return true for invalid email without @", () => {
|
|
expect(isNotACompanyEmail("invalidemail")).toBe(true);
|
|
});
|
|
|
|
it("should return true for empty email", () => {
|
|
expect(isNotACompanyEmail("")).toBe(true);
|
|
});
|
|
|
|
it("should return true for email with multiple @ symbols", () => {
|
|
expect(isNotACompanyEmail("user@@company.com")).toBe(false);
|
|
});
|
|
|
|
it("should return true for all popular personal email providers", () => {
|
|
const personalProviders = [
|
|
"gmail.com",
|
|
"yahoo.com",
|
|
"outlook.com",
|
|
"hotmail.com",
|
|
"aol.com",
|
|
"icloud.com",
|
|
"mail.com",
|
|
"protonmail.com",
|
|
"proton.me",
|
|
"zoho.com",
|
|
"yandex.com",
|
|
"gmx.com",
|
|
"fastmail.com",
|
|
"inbox.com",
|
|
"me.com",
|
|
"hushmail.com",
|
|
"live.com",
|
|
"rediffmail.com",
|
|
"tutanota.com",
|
|
"mail.ru",
|
|
"usa.com",
|
|
"qq.com",
|
|
"163.com",
|
|
"web.de",
|
|
"rocketmail.com",
|
|
"excite.com",
|
|
"lycos.com",
|
|
"outlook.co",
|
|
"hotmail.co.uk",
|
|
];
|
|
|
|
personalProviders.forEach((provider) => {
|
|
expect(isNotACompanyEmail(`user@${provider}`)).toBe(true);
|
|
});
|
|
});
|
|
|
|
it("should return false for various company domains", () => {
|
|
const companyDomains = [
|
|
"acme.com",
|
|
"techcorp.io",
|
|
"business.co",
|
|
"startup.ai",
|
|
"enterprise.net",
|
|
"cal.com",
|
|
];
|
|
|
|
companyDomains.forEach((domain) => {
|
|
expect(isNotACompanyEmail(`user@${domain}`)).toBe(false);
|
|
});
|
|
});
|
|
});
|
|
});
|