fix: Failing tests due to import sorting.

This commit is contained in:
cpojer
2026-02-01 10:41:31 +09:00
parent 96c9ffdedc
commit 58f4185925
13 changed files with 62 additions and 50 deletions

View File

@@ -53,6 +53,12 @@ const normalizeText = (value?: string) =>
.replace(/\r/g, "\n")
.trim();
const normalizePathEntries = (value?: string) =>
normalizeText(value)
.split(/[:\s]+/)
.map((entry) => entry.trim())
.filter(Boolean);
describe("exec PATH login shell merge", () => {
const originalPath = process.env.PATH;
@@ -74,9 +80,9 @@ describe("exec PATH login shell merge", () => {
const tool = createExecTool({ host: "gateway", security: "full", ask: "off" });
const result = await tool.execute("call1", { command: "echo $PATH" });
const text = normalizeText(result.content.find((c) => c.type === "text")?.text);
const entries = normalizePathEntries(result.content.find((c) => c.type === "text")?.text);
expect(text).toBe("/custom/bin:/opt/bin:/usr/bin");
expect(entries).toEqual(["/custom/bin", "/opt/bin", "/usr/bin"]);
expect(shellPathMock).toHaveBeenCalledTimes(1);
});
@@ -96,9 +102,9 @@ describe("exec PATH login shell merge", () => {
command: "echo $PATH",
env: { PATH: "/explicit/bin" },
});
const text = normalizeText(result.content.find((c) => c.type === "text")?.text);
const entries = normalizePathEntries(result.content.find((c) => c.type === "text")?.text);
expect(text).toBe("/explicit/bin");
expect(entries).toEqual(["/explicit/bin"]);
expect(shellPathMock).not.toHaveBeenCalled();
});
});