/*
RFC-0500: PBT for the ratgeber topics→articles migrator —
verifies idempotency f(f(x))==f(x) on synthetic fixture data.
- Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.
- RFC-0500: initial PBT for topics→articles migrator.
- RFC-1249: wire werkstatt.commands.validate into packages.check + retire CMD-OUTPUT debt
*/
import { test, expect } from "vitest";
import fs from "node:fs/promises";
import path from "node:path";
import os from "node:os";
import { rfc0500Migrator } from "./rfc-0500.ts";
import type { SternsystemData, MigrationContext } from "./types.ts";
const ctx: MigrationContext = {
systemId: "test",
missionId: "test-mission",
logger: { info: () => {} },
};
async function createWorkpiece(): Promise {
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "rfc-0500-pbt-"));
const topicsDir = path.join(dir, "src", "content", "surface", "topics", "de");
await fs.mkdir(topicsDir, { recursive: true });
await fs.writeFile(
path.join(topicsDir, "website-kosten.md"),
"---\nname: Website Kosten\nslug: website-kosten\nintro: Was kostet eine Website?\nsections:\n - heading: Überblick\n body: Die Kosten hängen von verschiedenen Faktoren ab.\n---\n",
);
return dir;
}
async function snapshotDir(dir: string): Promise