29 lines
1.3 KiB
TypeScript
29 lines
1.3 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
import { listPathOfThread } from "./utils";
|
|
import type { AgentThread } from "./types";
|
|
|
|
const projectThread = {
|
|
thread_id: "chat-1",
|
|
metadata: { analysis_project_id: "project-1" },
|
|
} as unknown as AgentThread;
|
|
|
|
test("project history keeps the My Projects workspace and return destination", () => {
|
|
for (const current of ["", "/page/strategy/qa/projects", "/page/strategy/qa/projects/groups/project-1/chats/chat-1"]) {
|
|
assert.equal(listPathOfThread(projectThread, current), "/page/strategy/qa/projects/groups/project-1/chats/chat-1");
|
|
}
|
|
});
|
|
|
|
test("solution project history stays in the solution collection", () => {
|
|
const solutionThread = {
|
|
...projectThread,
|
|
metadata: { ...projectThread.metadata, analysis_project_mode: "solution" },
|
|
} as unknown as AgentThread;
|
|
assert.equal(listPathOfThread(solutionThread), "/page/strategy/qa/projects/solutions/project-1/chats/chat-1");
|
|
});
|
|
|
|
test("ordinary and bootstrap chat routes remain available", () => {
|
|
assert.equal(listPathOfThread({ thread_id: "chat-2", metadata: {} } as unknown as AgentThread, "/page/strategy/qa/projects"), "/page/workspace/chats/chat-2");
|
|
assert.equal(listPathOfThread({ thread_id: "setup", metadata: { thread_type: "bootstrap" } } as unknown as AgentThread), "/page/workspace/agents/new/setup");
|
|
});
|