Skip to content

Commit eabded9

Browse files
Jasmine ZhangJasmine Zhang
authored andcommitted
test: cover slash-prefixed Windows gateway task names
1 parent 7426916 commit eabded9

1 file changed

Lines changed: 27 additions & 25 deletions

File tree

src/daemon/inspect.test.ts

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -385,30 +385,32 @@ describe("findExtraGatewayServices (win32)", () => {
385385
]);
386386
});
387387

388-
it("ignores the canonical OpenClaw scheduled task when schtasks prefixes it with a backslash", async () => {
389-
execSchtasksMock.mockResolvedValueOnce({
390-
code: 0,
391-
stdout: [
392-
"TaskName: \\OpenClaw Gateway",
393-
"Task To Run: C:\\Program Files\\OpenClaw\\openclaw.exe gateway run",
394-
"",
395-
"TaskName: \\Clawdbot Legacy",
396-
"Task To Run: C:\\clawdbot\\clawdbot.exe run",
397-
"",
398-
].join("\n"),
399-
stderr: "",
400-
});
401-
402-
const result = await findExtraGatewayServices({}, { deep: true });
403-
expect(result).toEqual([
404-
{
405-
platform: "win32",
406-
label: "\\Clawdbot Legacy",
407-
detail: "task: \\Clawdbot Legacy, run: C:\\clawdbot\\clawdbot.exe run",
408-
scope: "system",
409-
marker: "clawdbot",
410-
legacy: true,
411-
},
412-
]);
388+
it("ignores the canonical OpenClaw scheduled task when schtasks prefixes it with a slash or backslash", async () => {
389+
for (const canonicalTaskName of ["\\OpenClaw Gateway", "/OpenClaw Gateway"]) {
390+
execSchtasksMock.mockResolvedValueOnce({
391+
code: 0,
392+
stdout: [
393+
`TaskName: ${canonicalTaskName}`,
394+
"Task To Run: C:\\Program Files\\OpenClaw\\openclaw.exe gateway run",
395+
"",
396+
"TaskName: \\Clawdbot Legacy",
397+
"Task To Run: C:\\clawdbot\\clawdbot.exe run",
398+
"",
399+
].join("\n"),
400+
stderr: "",
401+
});
402+
403+
const result = await findExtraGatewayServices({}, { deep: true });
404+
expect(result).toEqual([
405+
{
406+
platform: "win32",
407+
label: "\\Clawdbot Legacy",
408+
detail: "task: \\Clawdbot Legacy, run: C:\\clawdbot\\clawdbot.exe run",
409+
scope: "system",
410+
marker: "clawdbot",
411+
legacy: true,
412+
},
413+
]);
414+
}
413415
});
414416
});

0 commit comments

Comments
 (0)