diff --git a/apps/web/src/app/accounts/page.tsx b/apps/web/src/app/accounts/page.tsx index d847734..4a8eb0c 100644 --- a/apps/web/src/app/accounts/page.tsx +++ b/apps/web/src/app/accounts/page.tsx @@ -1,11 +1,10 @@ import { AccountsListView } from "@/components/accounts-list-view"; import { getSeededOperator } from "@/lib/operator"; import { listAccounts } from "@/lib/queries"; -import { deleteAccountAction } from "@/actions/accounts"; export default async function AccountsPage() { const op = await getSeededOperator(); const accounts = await listAccounts(op.id); - return ; + return ; } diff --git a/apps/web/src/components/accounts-list-view.test.tsx b/apps/web/src/components/accounts-list-view.test.tsx index 415234b..e20e24a 100644 --- a/apps/web/src/components/accounts-list-view.test.tsx +++ b/apps/web/src/components/accounts-list-view.test.tsx @@ -16,21 +16,6 @@ vi.mock("next/link", () => ({ ), })); -// Radix Dialog uses portals + client refs. For SSR markup tests we want -// the trigger to be rendered inline (with `asChild`) and the content tree -// to render too, so we can assert dialog text deterministically. -vi.mock("./ui/dialog", () => ({ - Dialog: ({ children }: { children: ReactNode }) => <>{children}, - DialogTrigger: ({ children }: { children: ReactNode; asChild?: boolean }) => <>{children}, - DialogContent: ({ children }: { children: ReactNode }) => ( -
{children}
- ), - DialogHeader: ({ children }: { children: ReactNode }) =>
{children}
, - DialogTitle: ({ children }: { children: ReactNode }) =>

{children}

, - DialogDescription: ({ children }: { children: ReactNode }) =>
{children}
, - DialogFooter: ({ children }: { children: ReactNode }) =>
{children}
, -})); - const mkAccount = (over: Partial = {}): AccountsListAccount => ({ id: "a-1", label: "Personal", @@ -60,11 +45,9 @@ function render(html: string) { }; } -const noopAction = () => {}; - describe("AccountsListView", () => { describe("layout — accounts present", () => { - it("renders one cell per account, each with a main card and a delete card", () => { + it("renders exactly one card per account (no inline destructive triggers)", () => { const accounts = [ mkAccount({ id: "a-1", label: "Personal" }), mkAccount({ id: "a-2", label: "Work" }), @@ -72,100 +55,56 @@ describe("AccountsListView", () => { ]; const { count } = render( - renderToStaticMarkup( - , - ), + renderToStaticMarkup(), ); expect(count('data-testid="account-cell"')).toBe(3); expect(count('data-testid="account-card"')).toBe(3); - expect(count('data-testid="account-delete-card"')).toBe(3); }); - it("each main card links to /accounts/[id]", () => { - const { has } = render( - renderToStaticMarkup( - , - ), - ); - expect(has(/href="\/accounts\/abc-123"/)).toBe(true); - }); - - it("renders the account label in both the main card and the delete card", () => { + it("does NOT render any Delete affordance on the overview", () => { + // Account-level destructive actions live on the detail page only. const html = renderToStaticMarkup( - , + , ); - // Main card title - expect(html).toContain(">MyBiz<"); - // Delete card description references the account by name - expect(html).toContain("Remove MyBiz and its reminders"); - // Dialog confirmation also uses the label - expect(html).toMatch(/MyBiz<\/strong>/); + expect(html).not.toContain("Delete account"); + expect(html).not.toContain("Remove Sales"); + expect(html).not.toMatch(/data-testid="account-delete-card"/); + expect(html).not.toMatch(/aria-label="Delete /); }); - it("delete card uses a real - - - - - + ) : null} + + + ))} ) : ( diff --git a/apps/web/src/test/no-render-warnings.test.tsx b/apps/web/src/test/no-render-warnings.test.tsx index 36c67cf..c1d63f3 100644 --- a/apps/web/src/test/no-render-warnings.test.tsx +++ b/apps/web/src/test/no-render-warnings.test.tsx @@ -99,7 +99,7 @@ const account: AccountsListAccount = { describe("SSR render — no React errors or warnings", () => { it("AccountsListView (populated) renders cleanly", () => { const { errors, warns } = renderQuiet( - {}} />, + , ); expect(errors).toEqual([]); expect(warns).toEqual([]); @@ -107,7 +107,7 @@ describe("SSR render — no React errors or warnings", () => { it("AccountsListView (empty) renders cleanly", () => { const { errors, warns } = renderQuiet( - {}} />, + , ); expect(errors).toEqual([]); expect(warns).toEqual([]); @@ -153,7 +153,7 @@ describe("SSR render — no React errors or warnings", () => { describe("SSR markup — no
inside region for any //