3e237e177a
* feat: add code-walkthrough backend (MCP tool, service, persistence, WS events) * feat: render agent code walkthroughs as line-anchored cards + editor window * test: add code-walkthrough re-emit mock-agent scenario * fix: rework code-walkthrough UX (floating card, line reveal, minimize, clickable file) * fix: improve code walkthrough editor UX * fix: backfill walkthrough launcher after websocket connect * fix: improve walkthrough requests and editor anchors * fix: clear walkthrough highlights on close * feat: add walkthrough discard and prompt customization * fix: send walkthrough requests through saved prompt * fix: support postgres built-in prompt seeding * fix: address walkthrough review feedback * fix: address walkthrough review follow-ups * fix: harden walkthrough lifecycle races * fix: reuse walkthrough notification cleanup * fix: guard stale walkthrough file opens * fix: abort stale file opens before paint * fix: stabilize github settings e2e readiness * fix: use stable github settings e2e selector
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
clearOpenWalkthroughTaskId,
|
|
getOpenWalkthroughTaskId,
|
|
setOpenWalkthroughTaskId,
|
|
subscribeOpenWalkthroughTask,
|
|
} from "./walkthrough-open-state";
|
|
|
|
describe("walkthrough open state", () => {
|
|
it("tracks the currently open walkthrough task", () => {
|
|
setOpenWalkthroughTaskId(null);
|
|
|
|
setOpenWalkthroughTaskId("task-1");
|
|
expect(getOpenWalkthroughTaskId()).toBe("task-1");
|
|
|
|
clearOpenWalkthroughTaskId("other-task");
|
|
expect(getOpenWalkthroughTaskId()).toBe("task-1");
|
|
|
|
clearOpenWalkthroughTaskId("task-1");
|
|
expect(getOpenWalkthroughTaskId()).toBeNull();
|
|
});
|
|
|
|
it("notifies subscribers when the open task changes", () => {
|
|
setOpenWalkthroughTaskId(null);
|
|
let calls = 0;
|
|
const unsubscribe = subscribeOpenWalkthroughTask(() => {
|
|
calls += 1;
|
|
});
|
|
|
|
setOpenWalkthroughTaskId("task-1");
|
|
setOpenWalkthroughTaskId("task-1");
|
|
clearOpenWalkthroughTaskId("task-1");
|
|
unsubscribe();
|
|
setOpenWalkthroughTaskId("task-2");
|
|
|
|
expect(calls).toBe(2);
|
|
setOpenWalkthroughTaskId(null);
|
|
});
|
|
});
|