videogen/apps/web/lib/seo/llms.test.ts
caelum0x d56639a594
Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

63 lines
2.6 KiB
TypeScript

import * as fs from "node:fs";
import * as path from "node:path";
import { describe, expect, it } from "vitest";
import { checkUnits, type Denylist } from "@/src/shared/policy/copy-check";
import { offersFromPlanConfig } from "./entity";
import { buildLlmsText, llmsFlagsFromEnv } from "./llms";
const DENYLIST = JSON.parse(
fs.readFileSync(path.resolve(__dirname, "../../../../policy/copy-denylist.json"), "utf8"),
) as Denylist;
const OFF = { presenterLive: false, publishingLive: false } as const;
const GATED = /\b(presenters?|lip[- ]?sync(ed)?|avatars?|talking head|publish(ing)?|schedul(e|ing) posts?)\b/i;
describe("MA2 llms.txt", () => {
it("names no flag-gated feature while the flags are off", () => {
const text = buildLlmsText({ flags: OFF });
expect(text).not.toMatch(GATED);
});
it("reads the flags from the environment, off by default", () => {
expect(llmsFlagsFromEnv({})).toEqual(OFF);
expect(llmsFlagsFromEnv({ NEXT_PUBLIC_PRESENTER_LIVE: "1", NEXT_PUBLIC_PUBLISHING_LIVE: "true" })).toEqual({
presenterLive: true,
publishingLive: true,
});
});
it("describes a gated feature only when its flag is on", () => {
expect(buildLlmsText({ flags: { ...OFF, presenterLive: true } })).toMatch(/lip-synced/);
expect(buildLlmsText({ flags: { ...OFF, publishingLive: true } })).toMatch(/Publishing:/);
});
it("lists prices from plan config", () => {
const offers = offersFromPlanConfig();
const text = buildLlmsText({ flags: OFF, offers });
for (const offer of offers) expect(text).toContain(offer.name);
const typed = [
{ "@type": "Offer", name: "Test pack", price: "23.00", priceCurrency: "USD", description: "x.", url: "u" },
] as const;
expect(buildLlmsText({ flags: OFF, offers: typed })).toContain("Test pack: $23.");
});
it("is plain markdown with the canonical links", () => {
const text = buildLlmsText({ flags: OFF });
expect(text.startsWith("# Menivor\n")).toBe(true);
for (const p of ["/pricing", "/about", "/press", "/mcp", "/go/grok-bot"]) {
expect(text).toContain(`https://menivor.com${p}`);
}
expect(text).toContain("Menivor can be used from Grok Bot");
expect(text).not.toMatch(/<[a-z]/i);
});
it("passes the copy denylist with the flags off", () => {
const units = buildLlmsText({ flags: OFF })
.split("\n")
.filter(Boolean)
.map((line) => ({ text: line, path: "app/llms.txt/route.ts", surface: "marketing" as const }));
const hits = checkUnits(DENYLIST, units, { flags: {} }).filter((h) => h.severity === "error");
expect(hits).toEqual([]);
});
});