From 2a5fa426f2ebd7ab7336424ffbd288870f12957f Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 16 Feb 2026 06:32:59 +0000 Subject: [PATCH] test: remove redundant schtasks command parsing cases --- src/daemon/schtasks.test.ts | 68 ------------------------------------- 1 file changed, 68 deletions(-) diff --git a/src/daemon/schtasks.test.ts b/src/daemon/schtasks.test.ts index 90bf27aa9..e56754d6a 100644 --- a/src/daemon/schtasks.test.ts +++ b/src/daemon/schtasks.test.ts @@ -86,74 +86,6 @@ describe("resolveTaskScriptPath", () => { }); describe("readScheduledTaskCommand", () => { - it("parses basic command script", async () => { - const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-schtasks-test-")); - try { - const scriptPath = path.join(tmpDir, ".openclaw", "gateway.cmd"); - await fs.mkdir(path.dirname(scriptPath), { recursive: true }); - await fs.writeFile( - scriptPath, - ["@echo off", "node gateway.js --port 18789"].join("\r\n"), - "utf8", - ); - - const env = { USERPROFILE: tmpDir, OPENCLAW_PROFILE: "default" }; - const result = await readScheduledTaskCommand(env); - expect(result).toEqual({ - programArguments: ["node", "gateway.js", "--port", "18789"], - }); - } finally { - await fs.rm(tmpDir, { recursive: true, force: true }); - } - }); - - it("parses script with working directory", async () => { - const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-schtasks-test-")); - try { - const scriptPath = path.join(tmpDir, ".openclaw", "gateway.cmd"); - await fs.mkdir(path.dirname(scriptPath), { recursive: true }); - await fs.writeFile( - scriptPath, - ["@echo off", "cd /d C:\\Projects\\openclaw", "node gateway.js"].join("\r\n"), - "utf8", - ); - - const env = { USERPROFILE: tmpDir, OPENCLAW_PROFILE: "default" }; - const result = await readScheduledTaskCommand(env); - expect(result).toEqual({ - programArguments: ["node", "gateway.js"], - workingDirectory: "C:\\Projects\\openclaw", - }); - } finally { - await fs.rm(tmpDir, { recursive: true, force: true }); - } - }); - - it("parses script with environment variables", async () => { - const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-schtasks-test-")); - try { - const scriptPath = path.join(tmpDir, ".openclaw", "gateway.cmd"); - await fs.mkdir(path.dirname(scriptPath), { recursive: true }); - await fs.writeFile( - scriptPath, - ["@echo off", "set NODE_ENV=production", "set PORT=18789", "node gateway.js"].join("\r\n"), - "utf8", - ); - - const env = { USERPROFILE: tmpDir, OPENCLAW_PROFILE: "default" }; - const result = await readScheduledTaskCommand(env); - expect(result).toEqual({ - programArguments: ["node", "gateway.js"], - environment: { - NODE_ENV: "production", - PORT: "18789", - }, - }); - } finally { - await fs.rm(tmpDir, { recursive: true, force: true }); - } - }); - it("parses script with quoted arguments containing spaces", async () => { const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-schtasks-test-")); try {