/.exec(markup);
- if (firstRow === null) throw new Error("no body row");
- const cells = [...firstRow[0].matchAll(/| ]*>/g)];
- const cell = cells[index];
- if (cell === undefined) throw new Error("no Actions td");
- return cell[0];
-}
-
-function ruleFor(css: string, className: string): string {
- const selector = new RegExp(`\\.${className}\\s*[,{]`);
- const block = css.split("}").find((candidate) => selector.test(candidate));
- if (block === undefined) throw new Error(`no rule for .${className}`);
- return block.slice(block.indexOf("{"));
-}
-
-describe("PeopleTable Actions column", () => {
- test("Actions cells opt out of page-fill nowrap-ellipsis clipping", () => {
- const markup = renderToStaticMarkup(
- undefined}
- onReactivate={() => undefined}
- onRemove={() => undefined}
- onRoleChange={() => undefined}
- />,
- );
-
- expect(actionsCellOpenTag(markup)).toContain("settings-actions-cell");
- expect(markup).toContain("Remove");
-
- const css = readFileSync(new URL("../../src/settings/styles.css", import.meta.url), "utf8");
- const cell = ruleFor(css, "settings-actions-cell");
- expect(cell).toContain("overflow: visible");
- expect(cell).toContain("min-width");
- expect(cell).not.toContain("text-overflow: ellipsis");
- expect(cell).not.toContain("white-space: nowrap");
- expect(cell).not.toContain("overflow: hidden");
-
- const actions = ruleFor(css, "settings-row-actions");
- expect(actions).toContain("min-width");
- });
-});
diff --git a/apps/web/test/settings/query-retry.test.tsx b/apps/web/test/settings/query-retry.test.tsx
deleted file mode 100644
index 54d140df8a..0000000000
--- a/apps/web/test/settings/query-retry.test.tsx
+++ /dev/null
@@ -1,111 +0,0 @@
-// settings-ui's sections moved off the retry-less `LoadState` onto
-// `@/lib/api-query`'s `APIQuery` + `QueryView`, so a failed section load
-// now offers the same Retry affordance every other query in the app does.
-// One section (PeopleSection) stands in for every section here — each one
-// wires the same `describeQueryError`/retry pattern, so this is a check on
-// the shared machinery, not something worth repeating per section.
-
-import { afterEach, describe, expect, test } from "bun:test";
-import { act } from "react";
-import { createRoot } from "react-dom/client";
-import type { Root } from "react-dom/client";
-
-import { PeopleSection } from "../../src/settings/people-section";
-
-const realFetch = globalThis.fetch;
-afterEach(() => {
- globalThis.fetch = realFetch;
-});
-
-const json = (status: number, body: unknown) =>
- new Response(JSON.stringify(body), {
- status,
- headers: { "content-type": "application/json" },
- });
-
-const settle = () => act(() => new Promise((resolve) => setTimeout(resolve, 10)));
-
-function mount(): { container: HTMLDivElement; root: Root } {
- const container = document.createElement("div");
- document.body.appendChild(container);
- const root = createRoot(container);
- act(() => {
- root.render();
- });
- return { container, root };
-}
-
-describe("PeopleSection retry", () => {
- test("a failed load shows Retry, and clicking it recovers", async () => {
- let principalsCalls = 0;
- globalThis.fetch = (async (url: string) => {
- if (url === "/api/tenants/tnt_1/principals") {
- principalsCalls += 1;
- if (principalsCalls === 1) return json(500, {});
- return json(200, {
- data: [
- {
- id: "prn_human_1",
- tenantId: "tnt_1",
- kind: "user",
- refId: "user_1",
- displayName: "Alice Anderson",
- status: "active",
- roles: [],
- createdAt: "2026-01-01T00:00:00.000Z",
- updatedAt: "2026-01-01T00:00:00.000Z",
- },
- ],
- nextCursor: null,
- });
- }
- if (url === "/api/tenants/tnt_1/roles") {
- return json(200, { data: [], nextCursor: null });
- }
- throw new Error(`unexpected fetch: ${url}`);
- }) as unknown as typeof fetch;
-
- const { container, root } = mount();
- try {
- await settle();
- const retryButton = [...container.querySelectorAll("button")].find(
- (candidate) => candidate.textContent === "Retry",
- );
- expect(retryButton).not.toBeUndefined();
- expect(container.textContent).not.toContain("Alice Anderson");
-
- act(() => {
- retryButton?.dispatchEvent(new MouseEvent("click", { bubbles: true }));
- });
- await settle();
-
- expect(principalsCalls).toBe(2);
- expect(container.textContent).toContain("Alice Anderson");
- } finally {
- act(() => root.unmount());
- container.remove();
- }
- });
-
- test("a 401 renders sign-in-required, not the generic error state", async () => {
- globalThis.fetch = (async (url: string) => {
- if (url === "/api/tenants/tnt_1/principals") return json(401, {});
- if (url === "/api/tenants/tnt_1/roles") return json(401, {});
- throw new Error(`unexpected fetch: ${url}`);
- }) as unknown as typeof fetch;
-
- const { container, root } = mount();
- try {
- await settle();
- expect(container.textContent).toContain("Sign in required");
- expect(
- [...container.querySelectorAll("button")].some(
- (candidate) => candidate.textContent === "Retry",
- ),
- ).toBe(false);
- } finally {
- act(() => root.unmount());
- container.remove();
- }
- });
-});
diff --git a/apps/web/test/settings/raw-id-sweep.test.tsx b/apps/web/test/settings/raw-id-sweep.test.tsx
deleted file mode 100644
index b790244e38..0000000000
--- a/apps/web/test/settings/raw-id-sweep.test.tsx
+++ /dev/null
@@ -1,108 +0,0 @@
-// The UI floor's raw-id sweep: render every settings section's presentational
-// view with a full, realistic fixture — a bench, a workbench, and a user each
-// carrying a uuid-like id — and assert none of those ids ever reach visible
-// text. Attribute values (an ` |