Improve execution preflight diagnostics
This commit is contained in:
28
web/tests/unit/generated-gap-preflight.test.mjs
Normal file
28
web/tests/unit/generated-gap-preflight.test.mjs
Normal file
@@ -0,0 +1,28 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { collectGeneratedGapPreflight } from "../../../tools/web/generated-gap-preflight.mjs";
|
||||
import { readIndexedTask, root, verifyTaskIndex } from "../../../tools/web/task-context-lib.mjs";
|
||||
|
||||
test("generated gap preflight accepts a runnable task with existing inputs", () => {
|
||||
verifyTaskIndex();
|
||||
const entry = readIndexedTask("M16-GAP-00281");
|
||||
assert.deepEqual(collectGeneratedGapPreflight({ root, task: "M16-GAP-00281", entry }), []);
|
||||
});
|
||||
|
||||
test("generated gap preflight reports state and input failures before WASM startup", () => {
|
||||
const issues = collectGeneratedGapPreflight({
|
||||
root,
|
||||
task: "M16-GAP-00282",
|
||||
entry: {
|
||||
id: "M16-GAP-00282",
|
||||
state: "pending",
|
||||
fixture: { path: "tests/files/web/generated/does-not-exist.blend" },
|
||||
desktopCommand: "blender --python tools/web/generated/does-not-exist.py -- fixture.blend",
|
||||
},
|
||||
});
|
||||
assert.deepEqual(issues.map(({ code }) => code), ["TASK_NOT_RUNNABLE", "INPUT_MISSING", "INPUT_MISSING"]);
|
||||
});
|
||||
|
||||
test("generated gap preflight rejects a missing task argument", () => {
|
||||
assert.deepEqual(collectGeneratedGapPreflight({ root, task: undefined, entry: null }).map(({ code }) => code), ["TASK_ARGUMENT_INVALID"]);
|
||||
});
|
||||
Reference in New Issue
Block a user