test: tighten path prepend casing coverage

This commit is contained in:
Peter Steinberger
2026-03-14 00:28:34 +00:00
parent 3920c444cb
commit a9194f7a67

View File

@@ -11,6 +11,7 @@ describe("path prepend helpers", () => {
it("finds the actual PATH key while preserving original casing", () => {
expect(findPathKey({ PATH: "/usr/bin" })).toBe("PATH");
expect(findPathKey({ Path: "/usr/bin" })).toBe("Path");
expect(findPathKey({ path: "/usr/bin" })).toBe("path");
expect(findPathKey({ PaTh: "/usr/bin" })).toBe("PaTh");
expect(findPathKey({ HOME: "/tmp" })).toBe("PATH");
});
@@ -60,6 +61,10 @@ describe("path prepend helpers", () => {
applyPathPrepend(envWithoutPath, ["/custom/bin"], { requireExisting: true });
expect(envWithoutPath).toEqual({ HOME: "/tmp/home" });
const envWithBlankPath = { path: "" };
applyPathPrepend(envWithBlankPath, ["/custom/bin"], { requireExisting: true });
expect(envWithBlankPath).toEqual({ path: "" });
const envWithPath = { PATH: "/usr/bin" };
applyPathPrepend(envWithPath, [], { requireExisting: true });
applyPathPrepend(envWithPath, undefined, { requireExisting: true });