import { describe, expect, test } from "bun:test" import { createSyncSession } from "./sync-session-creator" describe("createSyncSession", () => { test("creates child session with question permission denied", async () => { // given const createCalls: Array> = [] const client = { session: { get: async () => ({ data: { directory: "/parent" } }), create: async (input: Record) => { createCalls.push(input) return { data: { id: "ses_child" } } }, }, } // when const result = await createSyncSession(client as never, { parentSessionID: "ses_parent", agentToUse: "explore", description: "test task", defaultDirectory: "/fallback", }) // then expect(result).toEqual({ ok: true, sessionID: "ses_child", parentDirectory: "/parent" }) expect(createCalls).toHaveLength(1) expect(createCalls[0]?.body).toEqual({ parentID: "ses_parent", title: "test task (@explore subagent)", permission: [ { permission: "question", action: "deny", pattern: "*" }, ], }) }) })