mirror of
https://gitee.com/zhangsken/opencode.git
synced 2026-10-16 10:30:01 +08:00
d3a156097d
Co-authored-by: dbpolito <347400+dbpolito@users.noreply.github.com>
19 lines
607 B
TypeScript
19 lines
607 B
TypeScript
import { expect, test } from "bun:test"
|
|
import { OpenCode } from "../src/promise/index"
|
|
|
|
test("session.create forwards parentID from the Promise client", async () => {
|
|
let body: unknown
|
|
const client = OpenCode.make({
|
|
baseUrl: "http://localhost:3000",
|
|
fetch: async (_input, init) => {
|
|
body = JSON.parse(String(init?.body))
|
|
return Response.json({ data: { id: "ses_child" } })
|
|
},
|
|
})
|
|
|
|
const child = await client.session.create({ parentID: "ses_parent", title: "Child" })
|
|
|
|
expect(child.id).toBe("ses_child")
|
|
expect(body).toEqual({ parentID: "ses_parent", title: "Child" })
|
|
})
|