mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
fix(insights): point sleep empty-state CTA at a real settings slug
This commit is contained in:
1 parent
d84c73af0d
commit
95739369e1
2 files changed
+37
-2
No files matched your search
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* v1.17.0 — the sleep empty-state CTA must point at a REAL settings slug.
|
||||
* It previously linked to `/settings/data-sources`, which is not in
|
||||
* `SETTINGS_SECTION_SLUGS`, so the dynamic `[section]` route calls
|
||||
* `notFound()` → a 404 dead-end. This pins the href to the `integrations`
|
||||
* slug 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 empty-state CTA href", () => {
|
||||
it("links to /settings/integrations (a real settings slug)", () => {
|
||||
const source = readFileSync(
|
||||
join(process.cwd(), "src/app/insights/sleep/page.tsx"),
|
||||
"utf8",
|
||||
);
|
||||
const match = source.match(/href="\/settings\/([a-z-]+)"/);
|
||||
expect(match, "expected a /settings/<slug> href in the sleep page").not.toBeNull();
|
||||
const slug = match![1];
|
||||
expect(slug).toBe("integrations");
|
||||
expect(isSettingsSectionSlug(slug)).toBe(true);
|
||||
});
|
||||
|
||||
it("never links to the removed /settings/data-sources slug", () => {
|
||||
const source = readFileSync(
|
||||
join(process.cwd(), "src/app/insights/sleep/page.tsx"),
|
||||
"utf8",
|
||||
);
|
||||
expect(source).not.toContain("/settings/data-sources");
|
||||
});
|
||||
});
|
||||
@@ -25,7 +25,7 @@ import { SubPageShell } from "@/components/insights/sub-page-shell";
|
||||
*
|
||||
* v1.4.27 F17 — when `summaries.SLEEP_DURATION.count === 0` (no
|
||||
* Apple-Health / Withings sleep rows yet), the page short-circuits
|
||||
* to an empty-state CTA pointing at `/settings/data-sources` so the
|
||||
* to an empty-state CTA pointing at `/settings/integrations` so the
|
||||
* user can connect a sleep source.
|
||||
*
|
||||
* v1.4.28 R3d (BK-F-H1 + BK-F-M1) — analytics fetch + empty-state
|
||||
@@ -50,7 +50,7 @@ export default function InsightsSchlafPage() {
|
||||
description={t("insights.emptyState.sleep.description")}
|
||||
cta={
|
||||
<Button size="sm" asChild>
|
||||
<Link href="/settings/data-sources">
|
||||
<Link href="/settings/integrations">
|
||||
{t("insights.emptyState.sleep.cta")}
|
||||
</Link>
|
||||
</Button>
|
||||
|
||||
Reference in new issue
Block a user