test(web): cover fork source links, AUR honesty and privacy wording
Guards the star-count removal, the fork source host constant, the Arch AUR wording, the unlinked unpublished Snap and AUR cards, the privacy claims and the install-page rule that the old name only appears with an upstream label.
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { SITE_NAME, SITE_URL } from "../seo";
|
||||
import {
|
||||
SITE_NAME,
|
||||
SITE_URL,
|
||||
SOURCE_REPO_URL,
|
||||
UPSTREAM_REPO_URL,
|
||||
} from "../seo";
|
||||
|
||||
const readPage = (...segments: string[]): string =>
|
||||
fs.readFileSync(path.join(process.cwd(), "src", "app", ...segments), "utf-8");
|
||||
@@ -104,3 +109,79 @@ describe("fork install honesty (ticket #24, AC1)", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("fork source and star count (spec16 review)", () => {
|
||||
const read = (...segments: string[]): string =>
|
||||
fs.readFileSync(path.join(process.cwd(), ...segments), "utf-8");
|
||||
|
||||
it("points the source link at the fork host, not upstream", () => {
|
||||
expect(SOURCE_REPO_URL).toBe("https://git.bongbetic.com/xavierk/voculinux");
|
||||
expect(UPSTREAM_REPO_URL).toBe("https://github.com/VocaHQ/vocalinux");
|
||||
});
|
||||
|
||||
it("never fetches or shows the upstream repository's star count", () => {
|
||||
const config = read("next.config.js");
|
||||
const chrome = read("src", "components", "site-chrome.tsx");
|
||||
for (const [name, source] of [
|
||||
["next.config.js", config],
|
||||
["site-chrome", chrome],
|
||||
] as const) {
|
||||
expect(`${name}: ${source}`).not.toMatch(/api\.github\.com/);
|
||||
expect(`${name}: ${source}`).not.toMatch(
|
||||
/stargazers|NEXT_PUBLIC_GITHUB_STARS/,
|
||||
);
|
||||
}
|
||||
expect(chrome).toContain("SOURCE_REPO_URL");
|
||||
});
|
||||
|
||||
it("uses the upstream constant only on labelled upstream surfaces", () => {
|
||||
const chrome = read("src", "components", "site-chrome.tsx");
|
||||
const nav = read("src", "lib", "site-nav.ts");
|
||||
expect(chrome).not.toContain("UPSTREAM_REPO_URL");
|
||||
expect(nav).not.toContain("UPSTREAM_REPO_URL");
|
||||
});
|
||||
});
|
||||
|
||||
describe("AUR and privacy honesty (spec16 review)", () => {
|
||||
const distro = readPage("install", "[distro]", "page.tsx");
|
||||
const install = readPage("install", "page.tsx");
|
||||
const offline = readPage("offline", "page.tsx");
|
||||
const home = readPage("page.tsx");
|
||||
|
||||
it("does not tell Arch users the AUR package is installable today", () => {
|
||||
expect(distro).not.toContain(
|
||||
"Arch users can install Voculinux from the AUR",
|
||||
);
|
||||
expect(distro).not.toContain("Install Voculinux from the AUR");
|
||||
expect(distro).toContain("AUR packages (not published yet)");
|
||||
});
|
||||
|
||||
it("does not link the unpublished AUR and Snap packages", () => {
|
||||
for (const [name, source] of [
|
||||
["home", home],
|
||||
["install", install],
|
||||
] as const) {
|
||||
expect(`${name}: ${source}`).not.toContain(
|
||||
"https://aur.archlinux.org/packages/voculinux",
|
||||
);
|
||||
expect(`${name}: ${source}`).not.toContain(
|
||||
"https://snapcraft.io/voculinux",
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it("claims no more than no usage telemetry in the installed app", () => {
|
||||
expect(offline).not.toContain("Zero Data Collection");
|
||||
expect(offline).not.toContain("Truly Private");
|
||||
expect(home).not.toContain("cannot see how many people install");
|
||||
expect(home).not.toContain("<span>No telemetry</span>");
|
||||
});
|
||||
|
||||
it("names the install-page launcher as upstream wherever it spells the old name", () => {
|
||||
const bare = install
|
||||
.split("\n")
|
||||
.filter((line) => /vocalinux/i.test(line))
|
||||
.filter((line) => !/upstream|VocaHQ\//i.test(line));
|
||||
expect(bare).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user