mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 22:50:51 +00:00
test: delete text pins on things removed releases ago
Five tests only read source or message files to assert that something long gone stays gone: the moodLog bridge (removed in July), the chart's target-adjust link (v1.16.8), the mood notes timeline, the medication detail page's old dose card and wizard host (v1.15.18), and the obsolete v1.34.1 copy keys. They protect no behaviour, and the general i18n guards already hold every key and placeholder across the ten locales, which the v1.34.1 list did for nine. The source-read baseline drops from 337 to 332.
This commit is contained in:
1 parent
408c2abb39
commit
8f6081de89
8 files changed
+5
-492
No files matched your search
@@ -1,53 +0,0 @@
|
||||
/**
|
||||
* v1.16.8 — the in-header "adjust targets" link is gone from the chart
|
||||
* card. The affordance duplicated the page-level target-adjust control
|
||||
* in the insights sub-page header (`<TargetAdjustButton>`); the chart
|
||||
* stays a read surface. Pinned at the source level (same convention as
|
||||
* the auth-shell hoist contract) so the link doesn't quietly return on
|
||||
* a future header rework.
|
||||
*/
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { readSource, readSourceFolder } from "@/__tests__/helpers/source-files";
|
||||
|
||||
const WEIGHT_PAGE_PATH = resolve(
|
||||
__dirname,
|
||||
"../../../app/insights/weight/page.tsx",
|
||||
);
|
||||
const BP_PAGE_PATH = resolve(
|
||||
__dirname,
|
||||
"../../../app/insights/blood-pressure/page.tsx",
|
||||
);
|
||||
const EN_BUNDLE_PATH = resolve(__dirname, "../../../../messages/en.json");
|
||||
|
||||
describe("v1.16.8 — chart-card target-adjust link removed", () => {
|
||||
it("ships no targetSettingsHref prop or header link in the chart", () => {
|
||||
// The component and every part it is built from (header included).
|
||||
const source = [
|
||||
readSource("src/components/charts/health-chart.tsx", "HealthChart"),
|
||||
...readSourceFolder("src/components/charts/health-chart", {
|
||||
floor: 9,
|
||||
}).map(([, text]) => text),
|
||||
].join("\n");
|
||||
expect(source).not.toContain("targetSettingsHref");
|
||||
expect(source).not.toContain("chart-target-settings-link");
|
||||
expect(source).not.toContain("charts.adjustTargets");
|
||||
});
|
||||
|
||||
it("weight and blood-pressure pages no longer pass the link href", () => {
|
||||
for (const path of [WEIGHT_PAGE_PATH, BP_PAGE_PATH]) {
|
||||
const source = readFileSync(path, "utf8");
|
||||
expect(source).not.toContain("targetSettingsHref");
|
||||
}
|
||||
});
|
||||
|
||||
it("the orphaned locale key is gone", () => {
|
||||
const bundle = JSON.parse(readFileSync(EN_BUNDLE_PATH, "utf8")) as {
|
||||
charts: Record<string, unknown>;
|
||||
};
|
||||
expect(bundle.charts.adjustTargets).toBeUndefined();
|
||||
});
|
||||
});
|
||||
@@ -1,85 +0,0 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
||||
const COMPONENT_DIR = join(__dirname, "..");
|
||||
const MOOD_LIST = join(__dirname, "../../../mood/mood-list.tsx");
|
||||
/**
|
||||
* The two modules the mood insights surface is rendered from. The breakdown
|
||||
* cluster lives behind `next/dynamic` in its own file; both are the surface.
|
||||
*/
|
||||
const INSIGHTS_SURFACE_FILES = [
|
||||
join(COMPONENT_DIR, "mood-insights-sections.tsx"),
|
||||
join(COMPONENT_DIR, "mood-insights-breakdowns.tsx"),
|
||||
];
|
||||
|
||||
/**
|
||||
* v1.8.6 — the notes timeline display is removed from the mood insights
|
||||
* surface (note capture on the form stays). These structural guards keep
|
||||
* the surface from regressing back to a notes feed and keep long notes
|
||||
* truncated in the entries table.
|
||||
*/
|
||||
describe("mood notes timeline removal", () => {
|
||||
it("deletes the notes-timeline component file", () => {
|
||||
expect(existsSync(join(COMPONENT_DIR, "mood-notes-timeline.tsx"))).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
it("no longer renders the notes timeline from the insights sections", () => {
|
||||
// Both halves of the surface: the eager module that paints the calendar
|
||||
// and the assessment, and the deferred module that carries every
|
||||
// breakdown. A guard reading only one of them would go quiet the moment
|
||||
// the other grew a notes feed.
|
||||
for (const file of INSIGHTS_SURFACE_FILES) {
|
||||
const src = readFileSync(file, "utf8");
|
||||
expect(src).not.toContain("MoodNotesTimeline");
|
||||
expect(src).not.toContain("notesTimeline");
|
||||
expect(src).not.toContain("notesTimelineTitle");
|
||||
}
|
||||
});
|
||||
|
||||
it("mounts the narrative feed in the insights sections", () => {
|
||||
// v1.12.7 — the narrative one-liners now ride the merged "What stands out"
|
||||
// card (`MoodWhatStandsOut`), which renders `MoodNarrativeFeed` internally.
|
||||
// The structural guard tracks the mount point on the sections surface.
|
||||
//
|
||||
// v1.38 — that mount point moved into `mood-insights-breakdowns.tsx` when
|
||||
// the below-the-fold cluster went behind `next/dynamic`. Read as the union
|
||||
// of the two files, so the guard asserts the card is mounted SOMEWHERE on
|
||||
// the surface rather than in one particular file — which is what it was
|
||||
// always about.
|
||||
const src = INSIGHTS_SURFACE_FILES.map((f) => readFileSync(f, "utf8")).join(
|
||||
"\n",
|
||||
);
|
||||
expect(src).toContain("MoodWhatStandsOut");
|
||||
expect(src).toContain("MoodInTargetTile");
|
||||
});
|
||||
|
||||
it("renders the narrative feed inside the merged what-stands-out card", () => {
|
||||
const src = readFileSync(
|
||||
join(COMPONENT_DIR, "mood-what-stands-out.tsx"),
|
||||
"utf8",
|
||||
);
|
||||
expect(src).toContain("MoodNarrativeFeed");
|
||||
expect(src).toContain("MoodDiscoveredRelations");
|
||||
});
|
||||
});
|
||||
|
||||
describe("mood entries table — long-note truncation", () => {
|
||||
const src = readFileSync(MOOD_LIST, "utf8");
|
||||
|
||||
it("caps the note column width to prevent horizontal scroll", () => {
|
||||
expect(src).toContain("max-w-[18rem]");
|
||||
});
|
||||
|
||||
it("clamps the note by default and exposes the full text via the row toggle", () => {
|
||||
// v1.16.8 — the desktop hover tooltip is replaced by an expandable
|
||||
// toggle (works on touch, preserves line breaks via pre-wrap). The
|
||||
// default presentation stays clamped so the table keeps its density.
|
||||
expect(src).toContain("line-clamp-2");
|
||||
expect(src).toContain("mood-note-toggle");
|
||||
expect(src).toContain("whitespace-pre-wrap");
|
||||
expect(src).not.toContain("TooltipContent");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user