Show optimistic chat for new workspaces

This commit is contained in:
Mohamed Boudra
2026-05-25 21:26:31 +07:00
parent d271597ee8
commit 30a8bffc24
11 changed files with 452 additions and 140 deletions
@@ -0,0 +1,44 @@
import { describe, expect, it } from "vitest";
import { buildDraftPanelDescriptor } from "@/panels/draft-panel-descriptor";
function TestIcon() {
return null;
}
describe("buildDraftPanelDescriptor", () => {
it("uses the initial prompt title and running loader bucket during create", () => {
const descriptor = buildDraftPanelDescriptor({
isCreating: true,
pendingPrompt: "Build the dashboard",
icon: TestIcon,
});
expect(descriptor).toMatchObject({
label: "Build the dashboard",
subtitle: "Creating agent",
titleState: "ready",
statusBucket: "running",
});
});
it("falls back to the draft title for empty create prompts", () => {
const descriptor = buildDraftPanelDescriptor({
isCreating: true,
pendingPrompt: " ",
icon: TestIcon,
});
expect(descriptor.label).toBe("New Agent");
});
it("keeps ordinary draft tabs labeled as new agents", () => {
const descriptor = buildDraftPanelDescriptor({ isCreating: false, icon: TestIcon });
expect(descriptor).toMatchObject({
label: "New Agent",
subtitle: "New Agent",
titleState: "ready",
statusBucket: null,
});
});
});