25 lines
1.1 KiB
TypeScript
25 lines
1.1 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
import { mkdtemp, rm } from "node:fs/promises";
|
|
import { tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
import { DEFAULT_CONFIG } from "../src/domain";
|
|
import { createState } from "../src/state";
|
|
import { buildHiveMission, missionToTaskBatch } from "../src/studio";
|
|
|
|
test("Hive mission is bounded, ownership-aware, and translated to one native task batch", async () => {
|
|
const root = await mkdtemp(join(tmpdir(), "pom-hive-"));
|
|
try {
|
|
const config = { ...DEFAULT_CONFIG, maxStudioAgents: 2 };
|
|
const state = createState("Hive Test", root, config);
|
|
const mission = buildHiveMission(state, config, "stage");
|
|
assert.ok(mission.tasks.length > 0 && mission.tasks.length <= 2);
|
|
const batch = missionToTaskBatch(state, mission);
|
|
assert.equal(batch.tasks.length, mission.tasks.length);
|
|
assert.match(batch.context, /native IRC/);
|
|
assert.ok(batch.tasks.every((item) => item.task.includes("pom_hive op=signal")));
|
|
} finally {
|
|
await rm(root, { recursive: true, force: true });
|
|
}
|
|
});
|