Task 007 add agent job admin runner follow-up
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
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/agent-jobs/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 { buildAgentJobRows } = moduleExports;
|
||||
|
||||
const rows = buildAgentJobRows([
|
||||
{
|
||||
id: "11111111-1111-1111-1111-111111111111",
|
||||
article_id: null,
|
||||
parent_job_id: "00000000-0000-0000-0000-000000000000",
|
||||
attempt: 2,
|
||||
job_type: "TEST_CODEX",
|
||||
agent_profile: "fake-codex",
|
||||
status: "SUCCEEDED",
|
||||
workspace_path: "/tmp/job",
|
||||
input_files: [{ path: "inputs/job.json" }],
|
||||
output_files: [{ path: "outputs/result.json" }],
|
||||
error_category: null,
|
||||
error_message: null,
|
||||
stdout: "done",
|
||||
stderr: "",
|
||||
exit_code: 0,
|
||||
duration_ms: 5,
|
||||
queued_at: "2026-05-21T00:00:00Z",
|
||||
started_at: "2026-05-21T00:00:01Z",
|
||||
finished_at: "2026-05-21T00:00:02Z",
|
||||
},
|
||||
]);
|
||||
|
||||
assert.equal(rows.length, 1);
|
||||
assert.equal(rows[0].status, "SUCCEEDED");
|
||||
assert.equal(rows[0].attempt, 2);
|
||||
assert.equal(rows[0].parentJobId, "00000000-0000-0000-0000-000000000000");
|
||||
assert.equal(rows[0].outputFiles, "outputs/result.json");
|
||||
assert.equal(rows[0].stdout, "done");
|
||||
Reference in New Issue
Block a user