Type session not-found errors (#25818)

This commit is contained in:
Kit Langton
2026-05-05 21:33:47 -04:00
committed by GitHub
parent f5c3d352a1
commit 8555de8189
22 changed files with 623 additions and 132 deletions

View File

@@ -72,14 +72,27 @@ describe("tui HttpApi bridge", () => {
properties: { text: "from publish" },
})
const missingSessionID = SessionID.descending()
const missing = await app().request(TuiPaths.selectSession, {
method: "POST",
headers: { ...headers, "content-type": "application/json" },
body: JSON.stringify({ sessionID: SessionID.descending() }),
body: JSON.stringify({ sessionID: missingSessionID }),
})
expect(missing.status).toBe(404)
})
test("matches Hono missing selected session error body", async () => {
await using tmp = await tmpdir({ git: true, config: { formatter: false, lsp: false } })
const headers = { "x-opencode-directory": tmp.path, "content-type": "application/json" }
const body = JSON.stringify({ sessionID: SessionID.descending() })
const hono = await app(false).request(TuiPaths.selectSession, { method: "POST", headers, body })
const httpapi = await app().request(TuiPaths.selectSession, { method: "POST", headers, body })
expect(httpapi.status).toBe(hono.status)
expect(await httpapi.json()).toEqual(await hono.json())
})
test("matches legacy unknown execute command behavior", async () => {
await using tmp = await tmpdir({ git: true, config: { formatter: false, lsp: false } })
const headers = { "x-opencode-directory": tmp.path, "content-type": "application/json" }