mirror of https://github.com/openclaw/openclaw.git
test: tighten brew helper coverage
This commit is contained in:
parent
3b9989bd90
commit
fffe587e27
|
|
@ -88,6 +88,35 @@ describe("brew helpers", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("ignores blank HOMEBREW_BREW_FILE and HOMEBREW_PREFIX values", async () => {
|
||||
await withBrewRoot(async (tmp) => {
|
||||
const homebrewBin = path.join(tmp, ".linuxbrew", "bin");
|
||||
const brewPath = path.join(homebrewBin, "brew");
|
||||
await writeExecutable(brewPath);
|
||||
|
||||
const env: NodeJS.ProcessEnv = {
|
||||
HOMEBREW_BREW_FILE: " ",
|
||||
HOMEBREW_PREFIX: "\t",
|
||||
};
|
||||
|
||||
expect(resolveBrewExecutable({ homeDir: tmp, env })).toBe(brewPath);
|
||||
|
||||
const dirs = resolveBrewPathDirs({ homeDir: tmp, env });
|
||||
expect(dirs).not.toContain(path.join("", "bin"));
|
||||
expect(dirs).not.toContain(path.join("", "sbin"));
|
||||
});
|
||||
});
|
||||
|
||||
it("always includes the standard macOS brew dirs after linuxbrew candidates", () => {
|
||||
const env: NodeJS.ProcessEnv = {
|
||||
HOMEBREW_BREW_FILE: " ",
|
||||
HOMEBREW_PREFIX: " ",
|
||||
};
|
||||
const dirs = resolveBrewPathDirs({ homeDir: "/home/test", env });
|
||||
|
||||
expect(dirs.slice(-2)).toEqual(["/opt/homebrew/bin", "/usr/local/bin"]);
|
||||
});
|
||||
|
||||
it("includes Linuxbrew bin/sbin in path candidates", () => {
|
||||
const env: NodeJS.ProcessEnv = { HOMEBREW_PREFIX: "/custom/prefix" };
|
||||
const dirs = resolveBrewPathDirs({ homeDir: "/home/test", env });
|
||||
|
|
|
|||
Loading…
Reference in New Issue