mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-19 08:12:52 +00:00
chore(release): v1.4.45 — analytics 9 s perf fix + audit-marathon closure + v1.4.44 hotfix merged
Audit-marathon close: 14 waves + W10 QA + reconcile. Perf fix (analytics 9 s -> 2-3 s), Zod multi-issue rollout (41 routes), Withings parked-state automation, mobile-UI WCAG 2.5.5 close, QoL i18n + offline banner + account delete, security PII drop + replay-injection scan. Migration 0075 required. Tests 4815 -> 5076.
This commit is contained in:
1 parent
324d4bb411
commit
6c7fc7dc84
167 files changed
+11233
-371
No files matched your search
@@ -0,0 +1,72 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
||||
/**
|
||||
* v1.4.43 W11-M5 — dashboard tile-strip skeleton during slow slim
|
||||
* fetches.
|
||||
*
|
||||
* Pre-fix the strip only painted once `trendCards.length > 0`. When
|
||||
* both slim + thick `/api/analytics` slices lagged (cache eviction,
|
||||
* cold start) the user saw the page header + zero tiles + then a
|
||||
* burst of tiles 9 s later. The fix paints a layout-stable silhouette
|
||||
* keyed off the user's configured tile count
|
||||
* (`layout.widgets.filter(w => w.tileVisible ?? w.visible).length`)
|
||||
* while `analyticsSlimQuery.isLoading` is still in flight, so the
|
||||
* page reserves the strip's footprint immediately and swaps to the
|
||||
* real tiles the moment slim resolves.
|
||||
*
|
||||
* Textual pins keep the contract honest — render-mounting the
|
||||
* dashboard page would haul in TanStack-Query, auth, i18n, layout
|
||||
* and analytics scaffolding for a guard a substring scan already
|
||||
* proves.
|
||||
*/
|
||||
const PAGE_PATH = join(process.cwd(), "src/app/page.tsx");
|
||||
|
||||
describe("v1.4.43 W11 — dashboard tile-strip skeleton", () => {
|
||||
it("derives `configuredTileCount` from the resolved layout", () => {
|
||||
const src = readFileSync(PAGE_PATH, "utf8");
|
||||
expect(src).toMatch(
|
||||
/const\s+configuredTileCount\s*=\s*layout\.widgets\.filter\([\s\S]*?w\.tileVisible\s*\?\?\s*w\.visible[\s\S]*?\)\.length;/,
|
||||
);
|
||||
});
|
||||
|
||||
it("gates the skeleton on slim-analytics loading + empty trend cards + configured tiles", () => {
|
||||
const src = readFileSync(PAGE_PATH, "utf8");
|
||||
expect(src).toMatch(
|
||||
/const\s+showTileStripSkeleton\s*=\s*[\s\S]*?trendCards\.length\s*===\s*0[\s\S]*?analyticsSlimQuery\.isLoading[\s\S]*?configuredTileCount\s*>\s*0/,
|
||||
);
|
||||
});
|
||||
|
||||
it("renders the skeleton with the same auto-fit grid track the real strip uses", () => {
|
||||
const src = readFileSync(PAGE_PATH, "utf8");
|
||||
expect(src).toMatch(
|
||||
/showTileStripSkeleton\s*&&\s*\(\s*<div[\s\S]*?\[grid-template-columns:repeat\(auto-fit,minmax\(min\(100%,11rem\),1fr\)\)\]/,
|
||||
);
|
||||
});
|
||||
|
||||
it("keys the skeleton card count off configuredTileCount", () => {
|
||||
const src = readFileSync(PAGE_PATH, "utf8");
|
||||
expect(src).toMatch(
|
||||
/Array\.from\(\{\s*length:\s*configuredTileCount\s*\}\)/,
|
||||
);
|
||||
});
|
||||
|
||||
it("marks the skeleton aria-hidden + carries motion-reduce", () => {
|
||||
const src = readFileSync(PAGE_PATH, "utf8");
|
||||
const skeletonBlock = src.match(
|
||||
/showTileStripSkeleton\s*&&[\s\S]*?<\/div>\s*\)\}/,
|
||||
);
|
||||
expect(skeletonBlock).not.toBeNull();
|
||||
const block = skeletonBlock?.[0] ?? "";
|
||||
expect(block).toContain('aria-hidden="true"');
|
||||
expect(block).toContain("motion-reduce:animate-none");
|
||||
});
|
||||
|
||||
it("suppresses the EmptyState while the skeleton is showing", () => {
|
||||
const src = readFileSync(PAGE_PATH, "utf8");
|
||||
expect(src).toMatch(
|
||||
/trendCards\.length\s*===\s*0\s*&&\s*charts\.length\s*===\s*0\s*&&\s*!showTileStripSkeleton/,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* v1.4.43 QoL (L1) — pin the tightened 404 / global-error copy so a
|
||||
* future translator does not re-introduce the v1.4.27 marketing
|
||||
* paragraph. The 404 page now ships with i18n keys (`notFound.*`)
|
||||
* across all six locales; the global-error boundary remains static
|
||||
* bilingual (no i18n provider available at that level).
|
||||
*/
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
||||
const ROOT = join(__dirname, "../../..");
|
||||
const LOCALES = ["en", "de", "fr", "es", "it", "pl"] as const;
|
||||
|
||||
interface Messages {
|
||||
notFound: {
|
||||
title: string;
|
||||
backToDashboard: string;
|
||||
};
|
||||
}
|
||||
|
||||
function load(locale: string): Messages {
|
||||
const raw = readFileSync(join(ROOT, "messages", `${locale}.json`), "utf8");
|
||||
return JSON.parse(raw) as Messages;
|
||||
}
|
||||
|
||||
describe("notFound copy", () => {
|
||||
it.each(LOCALES)("%s: ships title + backToDashboard keys", (locale) => {
|
||||
const messages = load(locale);
|
||||
expect(messages.notFound.title.trim().length).toBeGreaterThan(0);
|
||||
expect(messages.notFound.backToDashboard.trim().length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it.each(LOCALES)(
|
||||
"%s: title is tight — under 60 characters, ends with a period",
|
||||
(locale) => {
|
||||
const messages = load(locale);
|
||||
// Tightened copy is a single short statement, e.g. "Diese Seite
|
||||
// existiert nicht." The 60-char ceiling pins out a future return
|
||||
// of the verbose marketing block.
|
||||
expect(messages.notFound.title.length).toBeLessThanOrEqual(60);
|
||||
expect(messages.notFound.title).toMatch(/\.$/);
|
||||
},
|
||||
);
|
||||
|
||||
it("de: matches the tightened copy exactly", () => {
|
||||
const messages = load("de");
|
||||
expect(messages.notFound.title).toBe("Diese Seite existiert nicht.");
|
||||
});
|
||||
|
||||
it("en: matches the tightened copy exactly", () => {
|
||||
const messages = load("en");
|
||||
expect(messages.notFound.title).toBe("This page doesn't exist.");
|
||||
});
|
||||
});
|
||||
|
||||
describe("global-error bilingual copy", () => {
|
||||
// The global-error boundary cannot reach the i18n provider (root
|
||||
// layout has failed). The v1.4.43 audit asked for a bilingual
|
||||
// lockup so a German user does not read pure English in a bad-
|
||||
// state moment. Read the file and assert both languages appear.
|
||||
const globalErrorPath = join(ROOT, "src/app/global-error.tsx");
|
||||
const source = readFileSync(globalErrorPath, "utf8");
|
||||
|
||||
it("ships the German leading phrase next to the English fallback", () => {
|
||||
expect(source).toContain("Etwas ist schiefgegangen");
|
||||
expect(source).toContain("Something went wrong");
|
||||
});
|
||||
|
||||
it("ships the German error subtitle next to the English fallback", () => {
|
||||
expect(source).toContain("Ein kritischer Fehler ist aufgetreten");
|
||||
// The JSX-formatter wraps the English fallback across two lines, so
|
||||
// collapse all whitespace before searching.
|
||||
const collapsed = source.replace(/\s+/g, " ");
|
||||
expect(collapsed).toContain("A critical error occurred");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user