Refactor pipeline policies, MCP registry, and unified config/runtime
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtemp } from "node:fs/promises";
|
||||
import { mkdtemp, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { resolve } from "node:path";
|
||||
import { FileSystemProjectContextStore } from "../src/agents/project-context.js";
|
||||
@@ -13,6 +13,7 @@ test("project context store reads defaults and applies domain patches", async ()
|
||||
|
||||
const initial = await store.readState();
|
||||
assert.deepEqual(initial, {
|
||||
schemaVersion: 1,
|
||||
globalFlags: {},
|
||||
artifactPointers: {},
|
||||
taskQueue: [],
|
||||
@@ -55,4 +56,35 @@ test("project context store reads defaults and applies domain patches", async ()
|
||||
updated.taskQueue.map((task) => `${task.id}:${task.status}`),
|
||||
["task-1:in_progress", "task-2:pending"],
|
||||
);
|
||||
assert.equal(updated.schemaVersion, 1);
|
||||
});
|
||||
|
||||
test("project context parser merges missing root keys with defaults", async () => {
|
||||
const root = await mkdtemp(resolve(tmpdir(), "ai-ops-project-context-"));
|
||||
const filePath = resolve(root, "project-context.json");
|
||||
const store = new FileSystemProjectContextStore({ filePath });
|
||||
|
||||
await writeFile(
|
||||
filePath,
|
||||
`${JSON.stringify(
|
||||
{
|
||||
taskQueue: [
|
||||
{
|
||||
id: "task-1",
|
||||
title: "Migrate",
|
||||
status: "pending",
|
||||
},
|
||||
],
|
||||
},
|
||||
null,
|
||||
2,
|
||||
)}\n`,
|
||||
"utf8",
|
||||
);
|
||||
|
||||
const state = await store.readState();
|
||||
assert.equal(state.schemaVersion, 1);
|
||||
assert.deepEqual(state.globalFlags, {});
|
||||
assert.deepEqual(state.artifactPointers, {});
|
||||
assert.equal(state.taskQueue[0]?.id, "task-1");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user