diff --git a/src/__tests__/sharing-recoverable-errors.test.tsx b/src/__tests__/sharing-recoverable-errors.test.tsx index 43da41195..05e6618cf 100644 --- a/src/__tests__/sharing-recoverable-errors.test.tsx +++ b/src/__tests__/sharing-recoverable-errors.test.tsx @@ -353,8 +353,9 @@ describe("a refused invitation keeps what was typed", () => { const split = INVITE_CARD.indexOf("onError:", start); // The options object ends at the first ` },` after the error arm, so // the slice stops at the mutation rather than running into the JSX below, - // where a `setNarrowed(false)` on a radio would satisfy the matcher for - // the wrong reason. + // where a `setNarrowed(false)` / `setNarrowed(true)` on a radio would + // satisfy the matcher for the wrong reason. The success reset returns the + // scope to unset (`null`), which the JSX never writes. const end = INVITE_CARD.indexOf("\n },", split); const onSuccess = INVITE_CARD.slice(start, split); const onError = INVITE_CARD.slice(split, end); @@ -367,7 +368,7 @@ describe("a refused invitation keeps what was typed", () => { 'setIdentifier("")', 'setExpiresOn("")', 'setAccess("READ")', - "setNarrowed(false)", + "setNarrowed(null)", "setSections([])", ]) { expect(onSuccess, reset).toContain(reset); diff --git a/src/components/settings/access/__tests__/grant-access-level.test.tsx b/src/components/settings/access/__tests__/grant-access-level.test.tsx index d8ee6185a..b1c4f27f0 100644 --- a/src/components/settings/access/__tests__/grant-access-level.test.tsx +++ b/src/components/settings/access/__tests__/grant-access-level.test.tsx @@ -16,11 +16,20 @@ * a rewrite that quietly drops it should fail here. */ import { renderToStaticMarkup } from "react-dom/server"; +import { readFileSync } from "node:fs"; +import { join } from "node:path"; import { describe, expect, it, vi } from "vitest"; import { I18nProvider } from "@/lib/i18n/context"; import type { GrantList, GrantRow } from "@/lib/queries/use-account-grants"; +/** The shipped English invite copy, the source of truth for the consent text. */ +const inviteBundle = ( + JSON.parse(readFileSync(join(process.cwd(), "messages/en.json"), "utf8")) as { + recordSharing: { invite: Record }; + } +).recordSharing.invite; + const grantsRef: { value: GrantList } = { value: grantList() }; /** * A grant payload, with the audit window every real one carries. @@ -110,8 +119,11 @@ describe("offering a level", () => { // second group of radios in the same idiom, and a group that lost the ring // would be the same defect shipped again one section further down. const html = render(); + // Access options carry an (i) sibling now, so the row is a `
` with the + // radio in a nested `