fix(server): strengthen workspace root regression test

This commit is contained in:
Shantur Rathore
2026-04-26 15:45:02 +01:00
parent fc48826f86
commit 28a2df20ca
2 changed files with 3 additions and 2 deletions

View File

@@ -52,7 +52,7 @@ export interface WorkspaceDeleteResponse {
export type WorktreeKind = "root" | "worktree"
export interface WorktreeDescriptor {
/** Stable identifier used by CodeNomad + clients ("root" for repo root). */
/** Stable identifier used by CodeNomad + clients ("root" for the selected workspace folder). */
slug: string
/** Absolute directory path on the server host. */
directory: string

View File

@@ -23,7 +23,7 @@ describe("listWorktrees", () => {
"HEAD 1111111",
"branch refs/heads/main",
"",
].join("\\n")
].join("\n")
if (process.platform === "win32") {
writeFileSync(gitPath, `@echo off\r\nif "%1"=="worktree" if "%2"=="list" if "%3"=="--porcelain" (\r\necho ${porcelain.replace(/\n/g, "\r\necho ")}\r\nexit /b 0\r\n)\r\nexit /b 1\r\n`)
@@ -38,6 +38,7 @@ describe("listWorktrees", () => {
assert.equal(worktrees[0]?.slug, "root")
assert.equal(worktrees[0]?.directory, workspaceFolder)
assert.equal(worktrees[0]?.kind, "root")
assert.equal(worktrees[0]?.branch, "main")
assert.notEqual(worktrees[0]?.directory, repoRoot)
} finally {
process.env.PATH = originalPath