Files
oh-my-opencode/src/hooks/todo-continuation-enforcer/continuation-injection.test.ts
T

42 lines
1.3 KiB
TypeScript
Raw Normal View History

declare const require: (name: string) => any
const { describe, expect, test } = require("bun:test")
import { injectContinuation } from "./continuation-injection"
describe("injectContinuation", () => {
test("inherits tools from resolved message info when reinjecting", async () => {
// given
let capturedTools: Record<string, boolean> | undefined
const ctx = {
directory: "/tmp/test",
client: {
session: {
todo: async () => ({ data: [{ id: "1", content: "todo", status: "pending", priority: "high" }] }),
promptAsync: async (input: { body: { tools?: Record<string, boolean> } }) => {
capturedTools = input.body.tools
return {}
},
},
},
}
const sessionStateStore = {
getExistingState: () => ({ inFlight: false, lastInjectedAt: 0, consecutiveFailures: 0 }),
}
// when
await injectContinuation({
ctx: ctx as never,
sessionID: "ses_continuation_tools",
resolvedInfo: {
agent: "Hephaestus",
model: { providerID: "openai", modelID: "gpt-5.3-codex" },
tools: { question: "deny", bash: "allow" },
},
sessionStateStore: sessionStateStore as never,
})
// then
expect(capturedTools).toEqual({ question: false, bash: true })
})
})