Task 009 implement plan generation review gate
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import ts from "typescript";
|
||||
|
||||
const testDir = path.dirname(fileURLToPath(import.meta.url));
|
||||
const sourcePath = path.resolve(testDir, "../src/features/plan-review/model.ts");
|
||||
const source = readFileSync(sourcePath, "utf8");
|
||||
const compiled = ts.transpileModule(source, {
|
||||
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2022 },
|
||||
});
|
||||
|
||||
const moduleExports = {};
|
||||
new Function("exports", compiled.outputText)(moduleExports);
|
||||
|
||||
const { buildPlanReviewViews } = moduleExports;
|
||||
|
||||
const rows = buildPlanReviewViews([
|
||||
{
|
||||
id: "11111111-1111-1111-1111-111111111111",
|
||||
article_id: "22222222-2222-2222-2222-222222222222",
|
||||
version: 2,
|
||||
status: "PENDING_REVIEW",
|
||||
title_options: ["A", "B"],
|
||||
recommended_title: "Recommended",
|
||||
reader_persona: "Editors",
|
||||
search_intent: "Compare",
|
||||
thesis: "Thesis",
|
||||
sections: [{ id: "s", article_plan_id: "p", sort_order: 1, heading: "H" }],
|
||||
claims_to_prove: [],
|
||||
evidence_needs: ["Docs"],
|
||||
visual_needs: ["Diagram"],
|
||||
seo_notes: ["Keyword"],
|
||||
source_requirements: ["Primary"],
|
||||
excluded_sources: ["Forums"],
|
||||
tone: "Direct",
|
||||
audience: "Technical editors",
|
||||
risks: [],
|
||||
created_at: "2026-05-21T00:00:00Z",
|
||||
},
|
||||
]);
|
||||
|
||||
assert.equal(rows[0].version, 2);
|
||||
assert.equal(rows[0].recommendedTitle, "Recommended");
|
||||
assert.equal(rows[0].sectionCount, 1);
|
||||
assert.equal(rows[0].sourceRequirements, "Primary");
|
||||
assert.equal(rows[0].excludedSources, "Forums");
|
||||
assert.equal(rows[0].visualNeeds, "Diagram");
|
||||
Reference in New Issue
Block a user