mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-07 09:18:41 +00:00
fix(test): replace Unix-only assumptions with cross-platform alternatives (#14906)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test"
|
||||
import os from "os"
|
||||
import path from "path"
|
||||
import { BashTool } from "../../src/tool/bash"
|
||||
import { Instance } from "../../src/project/instance"
|
||||
@@ -138,14 +139,14 @@ describe("tool.bash permissions", () => {
|
||||
await bash.execute(
|
||||
{
|
||||
command: "ls",
|
||||
workdir: "/tmp",
|
||||
description: "List /tmp",
|
||||
workdir: os.tmpdir(),
|
||||
description: "List temp dir",
|
||||
},
|
||||
testCtx,
|
||||
)
|
||||
const extDirReq = requests.find((r) => r.permission === "external_directory")
|
||||
expect(extDirReq).toBeDefined()
|
||||
expect(extDirReq!.patterns).toContain("/tmp/*")
|
||||
expect(extDirReq!.patterns).toContain(path.join(os.tmpdir(), "*"))
|
||||
},
|
||||
})
|
||||
})
|
||||
@@ -366,7 +367,8 @@ describe("tool.bash truncation", () => {
|
||||
ctx,
|
||||
)
|
||||
expect((result.metadata as any).truncated).toBe(false)
|
||||
expect(result.output).toBe("hello\n")
|
||||
const eol = process.platform === "win32" ? "\r\n" : "\n"
|
||||
expect(result.output).toBe(`hello${eol}`)
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user