Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions frontend/__tests__/routes/root-layout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,20 @@ describe("MainApp", () => {
});
});

it("renders the app without a suspension when the selected organization is undefined", async () => {
useSelectedOrganizationStore.setState({
// Exercise an uninitialized selection rather than the store's null default.
organizationId: undefined,
});

renderMainApp();

expect(await screen.findByTestId("outlet-content")).toBeInTheDocument();
expect(
screen.queryByTestId("suspended-organization-modal"),
).not.toBeInTheDocument();
});

it("should block a suspended organization and offer the user's other organizations", async () => {
// Arrange
refuseAcmeSettings("Organization is suspended");
Expand Down
19 changes: 19 additions & 0 deletions frontend/__tests__/utils/signup-attribution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,25 @@ describe("Cloud signup entry", () => {
sessionStorage.clear();
});

it("retains handoff attribution without redirect or location origin", () => {
vi.stubGlobal("location", { href: "" });
try {
expect(() =>
rememberCloudEntry("marketing_website", {
utm_source: "newsletter",
utm_campaign: "launch",
}),
).not.toThrow();
expect(getSignupEntry()).toEqual({
signup_entry_source: "marketing_website",
utm_source: "newsletter",
utm_campaign: "launch",
});
} finally {
vi.unstubAllGlobals();
}
});

it("retains a website entry and safe campaign through OAuth and terms acceptance", () => {
rememberCloudEntry("marketing_website", {
utm_source: "newsletter",
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/routes/root-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,9 @@ export default function MainApp() {
// The server refused the selected organization (suspended org or
// membership). Unmount the app tree for the same reason as above; switching
// to another organization changes the selection and lifts the block.
if (suspension?.orgId === selectedOrganizationId) {
// Optional chaining would match an undefined selection when suspension is null.
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
if (suspension != null && suspension.orgId === selectedOrganizationId) {
return (
<div className="min-h-screen bg-base">
<SuspendedOrganizationModal
Expand Down
Loading