test(acp): make shell workdir location assertion windows-safe (#32306)

This commit is contained in:
Shoubhit Dash 2026-06-14 14:54:35 +02:00 committed by GitHub
parent 51461429f4
commit e4d4b07e7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,3 +1,4 @@
import { resolve } from "path"
import { describe, expect, test } from "bun:test"
import {
completedToolContent,
@ -38,8 +39,9 @@ describe("acp tool conversion", () => {
{ path: "/tmp/outside" },
])
expect(toLocations("bash", { cmd: "pwd" }, "/workspace")).toEqual([{ path: "/workspace" }])
// Relative workdir resolves against cwd via the platform path resolver (backslashes on Windows).
expect(toLocations("bash", { command: "pwd", workdir: "subdir" }, "/workspace")).toEqual([
{ path: "/workspace/subdir" },
{ path: resolve("/workspace", "subdir") },
])
expect(toLocations("bash", { command: "pwd", workdir: "/abs/dir" }, "/workspace")).toEqual([{ path: "/abs/dir" }])
expect(toLocations("bash", { command: "printf hello" })).toEqual([])