Wire pipeline DAG execution to manager with events and project context
This commit is contained in:
58
tests/project-context.test.ts
Normal file
58
tests/project-context.test.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtemp } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { resolve } from "node:path";
|
||||
import { FileSystemProjectContextStore } from "../src/agents/project-context.js";
|
||||
|
||||
test("project context store reads defaults and applies domain patches", async () => {
|
||||
const root = await mkdtemp(resolve(tmpdir(), "ai-ops-project-context-"));
|
||||
const store = new FileSystemProjectContextStore({
|
||||
filePath: resolve(root, "project-context.json"),
|
||||
});
|
||||
|
||||
const initial = await store.readState();
|
||||
assert.deepEqual(initial, {
|
||||
globalFlags: {},
|
||||
artifactPointers: {},
|
||||
taskQueue: [],
|
||||
});
|
||||
|
||||
await store.patchState({
|
||||
globalFlags: {
|
||||
requirements_defined: true,
|
||||
},
|
||||
artifactPointers: {
|
||||
prd: "docs/PRD.md",
|
||||
},
|
||||
enqueueTasks: [
|
||||
{
|
||||
id: "task-1",
|
||||
title: "Build parser",
|
||||
status: "pending",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const updated = await store.patchState({
|
||||
upsertTasks: [
|
||||
{
|
||||
id: "task-1",
|
||||
title: "Build parser",
|
||||
status: "in_progress",
|
||||
},
|
||||
{
|
||||
id: "task-2",
|
||||
title: "Add tests",
|
||||
status: "pending",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
assert.equal(updated.globalFlags.requirements_defined, true);
|
||||
assert.equal(updated.artifactPointers.prd, "docs/PRD.md");
|
||||
assert.deepEqual(
|
||||
updated.taskQueue.map((task) => `${task.id}:${task.status}`),
|
||||
["task-1:in_progress", "task-2:pending"],
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user