mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 13:52:20 +00:00
test(02-12): cover scoped navigation presentation
- prove profile uses a read-only shared route\n- cover scoped navigation independent of actor module flags\n- require action, access, and kind in record button names
This commit is contained in:
1 parent
9eab70f032
commit
34073cf8dc
3 files changed
+47
-1
No files matched your search
@@ -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]);
|
||||
|
||||
@@ -153,6 +153,18 @@ describe("<LookingAfterCard>", () => {
|
||||
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],
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user