mirror of
https://github.com/anomalyco/opencode.git
synced 2026-09-28 13:33:35 +08:00
test(cli): align ACP fixture contracts (#49251)
This commit is contained in:
@@ -574,7 +574,7 @@ function permissionReplies(fixture: Fixture) {
|
||||
return fixture.requests.flatMap((request): Array<[string, string]> => {
|
||||
const match = /^\/api\/session\/[^/]+\/permission\/([^/]+)\/reply$/.exec(request.path)
|
||||
if (!match?.[1] || !request.body || typeof request.body !== "object") return []
|
||||
const reply = "reply" in request.body ? request.body.reply : undefined
|
||||
const reply = "decision" in request.body ? request.body.decision : undefined
|
||||
return typeof reply === "string" ? [[decodeURIComponent(match[1]), reply]] : []
|
||||
})
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ export function createSseFixture(options: FixtureOptions = {}) {
|
||||
|
||||
const permission = /^\/api\/session\/([^/]+)\/permission\/([^/]+)\/reply$/.exec(url.pathname)
|
||||
if (permission?.[1] && permission[2]) {
|
||||
const reply = stringField(body, "reply")
|
||||
const reply = stringField(body, "decision")
|
||||
if (!reply) return new Response(null, { status: 400 })
|
||||
await options.onPermissionReply?.({
|
||||
sessionID: decodeURIComponent(permission[1]),
|
||||
@@ -140,8 +140,8 @@ export function createSseFixture(options: FixtureOptions = {}) {
|
||||
return new Response(null, { status: 204 })
|
||||
}
|
||||
|
||||
const form = /^\/api\/session\/([^/]+)\/form\/([^/]+)\/cancel$/.exec(url.pathname)
|
||||
if (form?.[1] && form[2]) {
|
||||
const form = /^\/api\/session\/([^/]+)\/form\/([^/]+)$/.exec(url.pathname)
|
||||
if (request.method === "DELETE" && form?.[1] && form[2]) {
|
||||
await options.onFormCancel?.({
|
||||
sessionID: decodeURIComponent(form[1]),
|
||||
formID: decodeURIComponent(form[2]),
|
||||
|
||||
Reference in New Issue
Block a user