Files
kandev/apps/web/components/task/chat/composer-workspace.test.ts
T
José Almeida 7de788ceed feat: add cross-integration entity references (#1862)
* feat: add cross-integration entity references

* fix(web): anchor entity reference menu to composer

* fix: keep Kandev tasks under @ mentions

* fix: address entity reference review findings

* test(e2e): use option role for prompt menu

* test(e2e): update passthrough mention roles

* fix: preserve queued references and paginate Azure PRs
2026-07-23 09:03:56 +01:00

49 lines
1.4 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { resolveComposerWorkspaceId } from "./composer-workspace";
const workflows = [{ id: "workflow-1", workspaceId: "workspace-1" }];
describe("resolveComposerWorkspaceId", () => {
it("uses the workspace persisted with a Quick Chat session", () => {
expect(
resolveComposerWorkspaceId({
sessionId: "quick-session",
taskId: null,
quickChatSessions: [{ sessionId: "quick-session", workspaceId: "quick-workspace" }],
activeWorkflowId: null,
activeTasks: [],
snapshots: [],
workflows,
}),
).toBe("quick-workspace");
});
it("maps a task through its loaded workflow", () => {
expect(
resolveComposerWorkspaceId({
sessionId: "task-session",
taskId: "task-1",
quickChatSessions: [],
activeWorkflowId: "workflow-1",
activeTasks: [{ id: "task-1" }],
snapshots: [],
workflows,
}),
).toBe("workspace-1");
});
it("fails closed when the task cannot be mapped to a workflow", () => {
expect(
resolveComposerWorkspaceId({
sessionId: "unknown-session",
taskId: "unknown-task",
quickChatSessions: [],
activeWorkflowId: "workflow-1",
activeTasks: [{ id: "another-task" }],
snapshots: [],
workflows,
}),
).toBeNull();
});
});