mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 15:23:29 +00:00
From the campaign's dead-code + code-health audits (grep-verified; the custom-metrics query-key finding was verified-false and excluded): - sleep-overview empty-state CTA linked to /settings/devices, not a valid settings slug (dynamicParams=false → 404). Repointed to /settings/integrations (where every device OAuth callback already lands). - six live, iOS-consumed routes were absent from docs/api/openapi.yaml — auth/check-user, insights/cards, integrations/healthkit (GET+PATCH), measurement-categories, medications/intake/bulk, mood-entries/bulk — registered in the Zod OpenAPI registry mirroring each handler's real shape. - mood/labs/medications module pages lacked the redirect-when-off self-guard their siblings have; added, mirroring cycle/achievements exactly. No migration. Verifier REJECTED the custom-metrics bare-key finding (they are invalidateQueries prefix filters, not colliding useQuery keys).
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
/**
|
|
* The sleep-overview empty-state CTA must point at a REAL settings slug.
|
|
* It previously linked to `/settings/devices`, which is not in
|
|
* `SETTINGS_SECTION_SLUGS`, so the dynamic `[section]` route (dynamicParams
|
|
* = false) calls `notFound()` → a hard 404 dead-end. This pins the href to
|
|
* the `integrations` slug (where every device OAuth callback lands) and
|
|
* guards against a regression to any non-existent slug.
|
|
*/
|
|
import { readFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import { isSettingsSectionSlug } from "@/components/settings/section-slugs";
|
|
|
|
describe("sleep-overview empty-state CTA href", () => {
|
|
it("links to /settings/integrations (a real settings slug)", () => {
|
|
const source = readFileSync(
|
|
join(process.cwd(), "src/components/insights/sleep-overview.tsx"),
|
|
"utf8",
|
|
);
|
|
const match = source.match(/href="\/settings\/([a-z-]+)"/);
|
|
expect(
|
|
match,
|
|
"expected a /settings/<slug> href in the sleep overview",
|
|
).not.toBeNull();
|
|
const slug = match![1];
|
|
expect(slug).toBe("integrations");
|
|
expect(isSettingsSectionSlug(slug)).toBe(true);
|
|
});
|
|
|
|
it("never links to the non-existent /settings/devices slug", () => {
|
|
const source = readFileSync(
|
|
join(process.cwd(), "src/components/insights/sleep-overview.tsx"),
|
|
"utf8",
|
|
);
|
|
expect(source).not.toContain("/settings/devices");
|
|
});
|
|
});
|