mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 02:20:38 +00:00
test: tighten brew helper coverage
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user