test(server): compare Git reconciliation paths across platforms

Use portable separators for relative checkout paths. Resolve the
expected repository root so a Windows short path does not fail the
checkout identity assertion.

Co-authored-by: Victor Dozal <v.dozal@live.com>
This commit is contained in:
paseo-bot[bot]
2026-11-22 03:13:33 +00:00
co-authored by Victor Dozal
parent ab8107757b
commit 9d64a5fc50
2 changed files with 6 additions and 4 deletions
@@ -325,7 +325,7 @@ class ObservedPlacements {
return this.checkoutReadCount;
}
/** Home-relative directories read since the last call, sorted. */
/** Home-relative directories read since the last call, with portable separators. */
takeCheckoutReads(): string[] {
return this.checkoutReadCwds.splice(0).sort();
}
@@ -376,7 +376,7 @@ class ObservedPlacements {
private async readCheckout(cwd: string): Promise<ProjectCheckoutLitePayload> {
this.checkoutReadCount += 1;
this.checkoutReadCwds.push(path.relative(this.home, cwd));
this.checkoutReadCwds.push(path.relative(this.home, cwd).split(path.sep).join("/"));
const configured = [...this.checkoutByCwd.entries()].find(([root]) =>
areEquivalentPaths(root, cwd),
)?.[1];
@@ -1,5 +1,6 @@
import { execFileSync } from "node:child_process";
import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
import { realpath } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
@@ -61,13 +62,14 @@ describe("getCheckoutIdentity", () => {
isPaseoOwnedWorktree: status.isPaseoOwnedWorktree,
});
}
const mainRepoRoot = await realpath(repoDir);
expect(await getCheckoutIdentity(linkedDir, { paseoHome })).toMatchObject({
currentBranch: "feature",
mainRepoRoot: repoDir,
mainRepoRoot,
});
expect(await getCheckoutIdentity(paseoWorktree.worktreePath, { paseoHome })).toMatchObject({
isPaseoOwnedWorktree: true,
mainRepoRoot: repoDir,
mainRepoRoot,
});
expect(await getCheckoutIdentity(plainDir, { paseoHome })).toEqual({ isGit: false });
});