shoc-frontend-new/config/pwa-manifest.test.ts
Adam Moussa 042b9db2ac
Some checks failed
CI / ci (push) Has been cancelled
Deploy / deploy (push) Has been cancelled
chore: correct Sea Haven branding and rewrite README (#25)
* fix: correct Sea Haven branding in page title and wordmark

* chore: use correct company name in docs and comments

* docs: rewrite README

* docs: add README badge block per github-standards

* fix: update command syntax in deployment instructions

* fix: replace template PWA icons and manifest branding

* test: assert PWA manifest branding
2026-07-17 13:17:21 -04:00

33 lines
1.2 KiB
TypeScript

import { readFileSync, existsSync } from "node:fs";
import path from "node:path";
import { describe, expect, it } from "vitest";
const root = path.resolve(__dirname, "..");
const manifest = JSON.parse(readFileSync(path.join(root, "public/manifest.json"), "utf-8")) as {
name: string;
short_name: string;
theme_color: string;
icons: Array<{ src: string }>;
};
const indexHtml = readFileSync(path.join(root, "index.html"), "utf-8");
describe("PWA install metadata", () => {
it("identifies the app as Sea Haven, not template branding", () => {
expect(manifest.name).toContain("Sea Haven");
expect(manifest.short_name).not.toBe("React App");
expect(manifest.name).not.toContain("Create React App");
});
it("uses the design-system theme color, matching index.html", () => {
expect(manifest.theme_color).toBe("#1c75bc");
expect(indexHtml).toContain(`<meta name="theme-color" content="${manifest.theme_color}" />`);
});
it("only references icon files that exist in public/", () => {
for (const icon of manifest.icons) {
expect(existsSync(path.join(root, "public", icon.src)), `missing public/${icon.src}`).toBe(
true,
);
}
});
});