diff --git a/src/__tests__/shared-record-navigation.test.tsx b/src/__tests__/shared-record-navigation.test.tsx index baed20fed..953e1cb07 100644 --- a/src/__tests__/shared-record-navigation.test.tsx +++ b/src/__tests__/shared-record-navigation.test.tsx @@ -41,6 +41,33 @@ describe("shared-record navigation", () => { expect(isDestinationInSharedRecord("/medications", ["labs"])).toBe(false); }); + it("keeps profile facts outside Settings and makes profile the scoped doorway", () => { + const navigation = resolveSharedRecordNavigation(["profile"]); + + expect(SHARED_RECORD_DOMAIN_ROUTE_FAMILIES.profile).toEqual(["/profile"]); + expect(navigation.destinationHrefs).toEqual(["/profile"]); + expect(navigation.allowsPath("/profile")).toBe(true); + expect(navigation.allowsPath("/settings/anamnesis")).toBe(false); + }); + + it("uses the active record scope instead of the actor's module flags", () => { + const actorModules = { + medications: false, + labs: false, + mood: false, + mentalHealth: false, + cycle: false, + illness: false, + inboundDocuments: false, + }; + + expect( + visibleNavDestinations(actorModules, true, true, ["medications"]).map( + (destination) => destination.href, + ), + ).toEqual(["/medications"]); + }); + it("keeps whole-record navigation distinct from an all-sections scope", () => { const wholeRecord = resolveSharedRecordNavigation(null); const allSections = resolveSharedRecordNavigation([...SHARE_DOMAINS]); diff --git a/src/components/dashboard/__tests__/looking-after-card.test.tsx b/src/components/dashboard/__tests__/looking-after-card.test.tsx index 196ca6620..42da0d447 100644 --- a/src/components/dashboard/__tests__/looking-after-card.test.tsx +++ b/src/components/dashboard/__tests__/looking-after-card.test.tsx @@ -153,6 +153,18 @@ describe("", () => { expect(html).toContain("Managed profile"); }); + it("names the record button with its action, access, and kind", () => { + const html = render({ + accounts: [MANAGED_PROFILE], + active: null, + canSwitch: true, + }); + + expect(html).toMatch( + /aria-label="Open Managed profile's record; Can read the record, add to it, and change or remove what is in it; Managed profile"/, + ); + }); + it("shows no health data, only a doorway", () => { const html = render({ accounts: [GRANDMOTHER], diff --git a/src/components/layout/__tests__/nav-model-shared-record.test.ts b/src/components/layout/__tests__/nav-model-shared-record.test.ts index 36061a96c..431106898 100644 --- a/src/components/layout/__tests__/nav-model-shared-record.test.ts +++ b/src/components/layout/__tests__/nav-model-shared-record.test.ts @@ -78,7 +78,14 @@ describe("the destination list under a switch", () => { it("changes nothing for a session in its own record", () => { const own = visibleNavDestinations(ALL_MODULES, true).map((d) => d.href); - expect(own).toEqual(NAV_DESTINATIONS.map((d) => d.href)); + expect(own).toEqual( + NAV_DESTINATIONS.filter((d) => !d.sharedRecordOnly).map((d) => d.href), + ); + expect(own).not.toContain("/profile"); + }); + + it("offers the read-only profile summary only inside a shared record", () => { + expect(hrefsInSharedRecord()).toContain("/profile"); }); });