leethobbit_obsidian-strong-.../tests/guide-export.test.ts
Dan 76d18f9826 M12-M15: phone shell, delight polish, release readiness, content & export expansion
M12: phone bottom bar + More sheet from nav-model placements, prep
master->detail with back header, soft-keyboard inset handling, narrow-header
and compact run top bar CSS; scanAll() profiled at ~1-2ms over 2,470 files.

M13: visibility-gated prep timer with under-30-minutes toast, dice tumble +
secret reveal flip (reduced-motion-safe), Alt+R inspiration shortcut, Home
Sessions sub-tab with rename-session modal, hint coverage extension, feature
toggles now live-refresh open views.

M14: naming shortlist collision-checked against community-plugins.json (all
candidates free; decision still pending), SCHEMA.md frozen at contract 1.0,
README rewritten with screenshots, Create demo campaign command.

M15: wilderness travel reference card in the 5e drawer, Lazy Solo 5e oracle
module behind a solo5e toggle, Copy player recap (revealed-secrets-only by
construction) and Copy session zero guide commands, quest generator saves
managed type: quest entities.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 12:14:36 -04:00

56 lines
2 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { buildSessionZeroGuide } from "../src/checklist/guide-export";
const CAMPAIGN_BODY = [
"## Campaign pitch",
"A slow apocalypse in a drowned valley.",
"",
"## Six truths",
"- The rains never stop.",
"- Magic rusts.",
"",
"## Fronts",
"### The Veiled Hand",
"Goal: drown the world.",
].join("\n");
describe("buildSessionZeroGuide", () => {
it("returns null when there is nothing to hand out", () => {
expect(buildSessionZeroGuide({ campaignName: "Test", campaignBody: "" })).toBeNull();
});
it("builds pitch + truths and never includes fronts", () => {
const guide = buildSessionZeroGuide({ campaignName: "Greenhollow", campaignBody: CAMPAIGN_BODY });
expect(guide).toContain("# Greenhollow — player guide");
expect(guide).toContain("A slow apocalypse in a drowned valley.");
expect(guide).toContain("- The rains never stop.");
expect(guide).not.toContain("Veiled Hand");
expect(guide).not.toContain("drown the world");
});
it("includes expectations and lines/veils from the session-zero note", () => {
const guide = buildSessionZeroGuide({
campaignName: "Greenhollow",
campaignBody: CAMPAIGN_BODY,
sessionZero: {
lines: ["harm to children"],
veils: ["torture"],
body: "## Expectations\nWeekly, three hours, roleplay-heavy.\n\n## Logistics\nMy place.",
},
});
expect(guide).toContain("Weekly, three hours, roleplay-heavy.");
expect(guide).toContain("**Lines (never on screen):**\n- harm to children");
expect(guide).toContain("**Veils (off-screen / fade out):**\n- torture");
expect(guide).not.toContain("My place.");
});
it("omits empty sections instead of emitting empty headings", () => {
const guide = buildSessionZeroGuide({
campaignName: "Test",
campaignBody: "## Campaign pitch\nJust a pitch.",
});
expect(guide).toContain("## The pitch");
expect(guide).not.toContain("## Truths of this world");
expect(guide).not.toContain("## Safety");
});
});