Files
paseo/packages/server/src/utils/git-rev-parse-path.test.ts
T
paseo-bot[bot] 9246813fd2 Preserve spaces in project folder names for Changes and worktrees (#6686)
* fix(workspaces): preserve spaces in project directory names

Git path output and app workspace descriptors each stripped significant path whitespace. Preserve directory names while retaining single-record Git output validation and workspace separator normalization.

* test(workspaces): capture Changes after files appear

* test(workspaces): release fixtures when setup fails

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-10-12 10:25:18 +02:00

27 lines
909 B
TypeScript

import { resolve } from "node:path";
import { describe, expect, it } from "vitest";
import { parseGitRevParsePath, resolveGitRevParsePath } from "./git-rev-parse-path.js";
describe("Git path output", () => {
it.each(["\n", "\r\n", ""])("preserves path whitespace with delimiter %j", (delimiter) => {
expect(parseGitRevParsePath(`/repo ${delimiter}`)).toBe("/repo ");
expect(parseGitRevParsePath(` relative path ${delimiter}`)).toBe(" relative path ");
});
it.each([
"",
"\n",
"\r\n",
"--path-format=absolute\n",
"--path-format=absolute\n/repo\n",
"/repo\n/another\n",
"/repo\n\n",
])("rejects invalid output %j", (output) => {
expect(parseGitRevParsePath(output)).toBeNull();
});
it("resolves a relative path without stripping its trailing space", () => {
expect(resolveGitRevParsePath("/base", "repo \n")).toBe(resolve("/base", "repo "));
});
});