Luigit
repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by admin

extensions/mockup/__tests__/guidance.test.ts

Raw
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import path from "node:path";
import { describe, it } from "vitest";

const root = path.resolve(import.meta.dirname, "..");

describe("mockup guidance", () => {
	it("defines the registered mockup authoring skill", () => {
		const guidance = readFileSync(
			path.join(root, "guidance", "mockup-html", "SKILL.md"),
			"utf8",
		);
		const frontmatter = guidance.split("---", 3)[1] ?? "";
		assert.match(frontmatter, /\nname: mockup-html\n/);
		assert.match(
			frontmatter,
			/description: "Use before creating or revising HTML fragments for the mockup tool's browser review\."/,
		);
		assert.match(
			guidance,
			/Each option is rendered in its own open `ShadowRoot`/,
		);
		assert.match(guidance, /document\.currentScript\.mockupRoot/);
		assert.match(
			guidance,
			/Rich interactions, scripts, and animations are allowed/,
		);
		assert.match(guidance, /runtime does not claim to sandbox or block/);
		assert.match(
			readFileSync(path.join(root, "README.md"), "utf8"),
			/\[HTML guidance skill\]\(guidance\/mockup-html\/SKILL\.md\)/,
		);
	});
});