Files
HiveGrid-Wireframes/hivegrid-cloud/apps/web/app/application/architectureHandoffSummary.test.ts
T

72 lines
2.6 KiB
TypeScript

import fs from "node:fs";
import path from "node:path";
import { describe, expect, it } from "vitest";
const rootDir = process.cwd();
const docs = {
handoffSummary: "docs/archive/architecture-handoff-summary.md",
agentEntrypoints: "docs/agent-entrypoints.md",
} as const;
const requiredCanonicalSources = [
"docs/architecture-migration-status.md",
"docs/feature-inventory.md",
"docs/feature-manifests/README.md",
"docs/feature-manifests/*.json",
"docs/agent-entrypoints.md",
"apps/web/app/application/architectureClosureDocs.test.ts",
"apps/web/app/application/featureManifests.test.ts",
];
const requiredGateCommands = [
"pnpm exec vitest run apps/web/app/application/architectureClosureDocs.test.ts apps/web/app/application/featureManifests.test.ts",
"pnpm exec eslint --ext .tsx,.ts",
"pnpm typecheck",
];
function readProjectFile(filePath: string) {
return fs.readFileSync(path.join(rootDir, filePath), "utf8");
}
describe("Architecture Closure handoff summary contract", () => {
it("keeps the executor-facing handoff summary present", () => {
expect(fs.existsSync(path.join(rootDir, docs.handoffSummary))).toBe(true);
});
it("anchors the handoff to every canonical closure source", () => {
const handoff = readProjectFile(docs.handoffSummary);
requiredCanonicalSources.forEach((sourcePath) => {
expect(handoff, sourcePath).toContain(sourcePath);
});
});
it("documents Architecture Closure requirement coverage and prior-slice closure continuity", () => {
const handoff = readProjectFile(docs.handoffSummary);
expect(handoff).toContain("R001");
expect(handoff).toContain("R002");
expect(handoff).toMatch(/S04 bundle\/performance continuity/i);
expect(handoff).toMatch(/sequential follow-up order/i);
expect(handoff).toMatch(/avoiding any assumption that downstream feature slices can run in parallel/i);
});
it("preserves the non-E2E full gate and manual build follow-up wording", () => {
const handoff = readProjectFile(docs.handoffSummary);
requiredGateCommands.forEach((command) => {
expect(handoff, command).toContain(command);
});
expect(handoff).toMatch(/No E2E, browser, Cypress, or Playwright execution/i);
expect(handoff).toMatch(/pnpm build.*optional manual follow-up/i);
expect(handoff).toMatch(/not an Auto-Mode completion gate/i);
});
it("keeps the agent entrypoint pointed at the Architecture Closure handoff in closure/status context", () => {
const entrypoints = readProjectFile(docs.agentEntrypoints);
expect(entrypoints).toContain("Architecture Closure closure/status contract");
expect(entrypoints).toContain(docs.handoffSummary);
});
});