fix(agent-switch): make handoff durable and sync CLI TUI selection
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
import { describe, test, expect, beforeEach } from "bun:test"
|
||||
import { setPendingSwitch, consumePendingSwitch, _resetForTesting } from "./state"
|
||||
const { describe, test, expect, beforeEach } = require("bun:test")
|
||||
import {
|
||||
setPendingSwitch,
|
||||
getPendingSwitch,
|
||||
clearPendingSwitch,
|
||||
consumePendingSwitch,
|
||||
_resetForTesting,
|
||||
} from "./state"
|
||||
|
||||
describe("agent-switch state", () => {
|
||||
beforeEach(() => {
|
||||
@@ -47,4 +53,21 @@ describe("agent-switch state", () => {
|
||||
expect(consumePendingSwitch("session-1")).toEqual({ agent: "atlas", context: "Fix A" })
|
||||
expect(consumePendingSwitch("session-2")).toEqual({ agent: "prometheus", context: "Plan B" })
|
||||
})
|
||||
|
||||
test("should allow reading without consuming", () => {
|
||||
setPendingSwitch("session-1", "atlas", "Fix A")
|
||||
|
||||
expect(getPendingSwitch("session-1")).toEqual({ agent: "atlas", context: "Fix A" })
|
||||
expect(getPendingSwitch("session-1")).toEqual({ agent: "atlas", context: "Fix A" })
|
||||
})
|
||||
|
||||
test("should clear pending switch explicitly", () => {
|
||||
setPendingSwitch("session-1", "atlas", "Fix A")
|
||||
|
||||
clearPendingSwitch("session-1")
|
||||
|
||||
expect(getPendingSwitch("session-1")).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
||||
export {}
|
||||
|
||||
Reference in New Issue
Block a user