fix(pwa): keep the Medications home-screen shortcut

The shortcut is the quickest way to a dose for everyone who tracks
medications. With the module switched off it opens the page that says so
and offers to turn it back on, which is a sensible landing, so the
shortcut stays. The unread `source=shortcut` parameter stays removed.
This commit is contained in:
Marc-André Bombeck committed 2026-11-11 21:33:07 +01:00
1 parent 212ff9ee55
commit 0278b6045e
2 files changed
+8 -12

No files matched your search

@@ -2,8 +2,6 @@ import { describe, expect, it } from "vitest";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { surfaceModule } from "@/lib/modules/surface";
/**
* F-7 (mobile security audit, 2026-05-16): three regressions to lock
* in for `public/sw.js`.
@@ -115,16 +113,6 @@ describe("public/manifest.json shortcuts", () => {
shortcuts: Array<{ name: string; url: string }>;
};
it("open only pages no module can switch off", () => {
// The manifest is static: a shortcut into a module would open the
// "switched off" notice for everyone who turned that module off.
expect(manifest.shortcuts.length).toBeGreaterThan(0);
for (const { name, url } of manifest.shortcuts) {
const { pathname } = new URL(url, "https://app.example");
expect(surfaceModule(`nav:${pathname}`), name).toBeUndefined();
}
});
it("carry no query parameter the app does not read", () => {
for (const { name, url } of manifest.shortcuts) {
expect(url, name).not.toContain("source=");