commit 9661592faacee2fac5d58d58bca2a9d69979ad6e
parent f0d5a7775036913987bce4b6cc14d325b081abbe
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 12 Nov 2026 10:15:58 -0500
common: the cast-assign body's test lives in controller/ -- lib/ may not import controller/ (architecture.test.ts), so the report-draft body checks moved beside the controller they test
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/common/controller/castAssign.test.ts b/common/controller/castAssign.test.ts
@@ -0,0 +1,15 @@
+// Characters C3: a `report-draft` body for the cast-assign task (controller/reportDraft.ts parseReportDraftBody): a
+// video project and the post authors to ask about; what is another task's refused.
+import { test } from "node:test";
+import assert from "node:assert/strict";
+import { parseReportDraftBody } from "./reportDraft";
+
+test("the body: a project and its handles; what is another task's refused", () => {
+ const b = parseReportDraftBody({ task: "cast-assign", project: "/p", handles: ["@Host", "guest", "guest"] });
+ assert.deepEqual([b.task, b.project, b.handles], ["cast-assign", "/p", ["host", "guest"]]);
+ assert.throws(() => parseReportDraftBody({ task: "cast-assign", article: "a" }), /names its "project"/);
+ assert.throws(() => parseReportDraftBody({ task: "cast-assign", project: "rel" }), /absolute directory/);
+ assert.throws(() => parseReportDraftBody({ task: "cast-assign", project: "/p", request: "x" }), /video-assist job's|takes no "request"/);
+ assert.throws(() => parseReportDraftBody({ task: "cast-assign", project: "/p", handles: ["bad handle!"] }), /post authors' handles/);
+ assert.throws(() => parseReportDraftBody({ task: "propose-groups", project: "/p", handles: ["a"] }), /"handles" is a cast-assign job's/);
+});
diff --git a/common/lib/report/draft/tasks/castAssign.test.ts b/common/lib/report/draft/tasks/castAssign.test.ts
@@ -1,7 +1,7 @@
// Characters C3: the `cast-assign` task on the fake ollama (the local route) -- one ask over the asked authors'
// names, bios and words (fenced as data), the answer checked field by field (a stock voice, a speed in bounds, one
// plain line; an author not asked, a second answer, junk refused), written as narration/cast-assign.json; the
-// manifest and the characters file untouched; the code route's answer read as a model's; the body parsed.
+// manifest and the characters file untouched; the code route's answer read as a model's (the body: controller/castAssign.test.ts).
import { after, before, test } from "node:test";
import assert from "node:assert/strict";
import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
@@ -10,7 +10,6 @@ import os from "node:os";
import path from "node:path";
import { jsonReply, startFakeOllama, type FakeOllama } from "../../../../testing/llm/fakeOllama.mjs";
import { CAST_ASSIGN_FILE, CAST_CODE_MODEL, CastAssignRefusal, STOCK_VOICE_SPECS, castAssignAnswers, castAuthors, planCastAssign, runCastAssign } from "./castAssign";
-import { parseReportDraftBody } from "../../../../controller/reportDraft";
import { GENERATION_PRESETS, GENERATION_TASKS, sanitizeGeneration } from "../../../generationSettings";
import type { LlmConfig } from "../../../llm";
@@ -113,13 +112,3 @@ test("the code route: a session's answer read as a model's; junk refused; a proj
await assert.rejects(runCastAssign({ project: dir, model: CAST_CODE_MODEL, handles: ["host"], answers: { nope: 1 } }, { llm }), CastAssignRefusal);
await assert.rejects(runCastAssign({ project: dir, model: "qwen3:8b", handles: ["ghost"] }, { llm }), /no post author to ask about/);
});
-
-test("the body: a project and its handles; what is another task's refused", () => {
- const b = parseReportDraftBody({ task: "cast-assign", project: "/p", handles: ["@Host", "guest", "guest"] });
- assert.deepEqual([b.task, b.project, b.handles], ["cast-assign", "/p", ["host", "guest"]]);
- assert.throws(() => parseReportDraftBody({ task: "cast-assign", article: "a" }), /names its "project"/);
- assert.throws(() => parseReportDraftBody({ task: "cast-assign", project: "rel" }), /absolute directory/);
- assert.throws(() => parseReportDraftBody({ task: "cast-assign", project: "/p", request: "x" }), /video-assist job's|takes no "request"/);
- assert.throws(() => parseReportDraftBody({ task: "cast-assign", project: "/p", handles: ["bad handle!"] }), /post authors' handles/);
- assert.throws(() => parseReportDraftBody({ task: "propose-groups", project: "/p", handles: ["a"] }), /"handles" is a cast-assign job's/);
-});