|
2 | 2 | import fs from "node:fs"; |
3 | 3 | import path from "node:path"; |
4 | 4 | import { describe, expect, it } from "vitest"; |
| 5 | +import { withMockedPlatform } from "../test-utils/vitest-spies.js"; |
5 | 6 | import { makeExecutable, makePathEnv, makeTempDir } from "./exec-approvals-test-helpers.js"; |
6 | 7 | import { |
7 | 8 | evaluateExecAllowlist, |
@@ -562,27 +563,25 @@ describe("exec-command-resolution", () => { |
562 | 563 | }); |
563 | 564 |
|
564 | 565 | it("does not synthesize cwd-joined allowlist candidates from drive-less windows roots", () => { |
565 | | - if (process.platform !== "win32") { |
566 | | - return; |
567 | | - } |
568 | | - |
569 | | - expect( |
570 | | - resolveAllowlistCandidatePath( |
571 | | - { |
572 | | - rawExecutable: String.raw`:\Users\demo\AI\system\openclaw`, |
573 | | - executableName: "openclaw", |
574 | | - }, |
575 | | - String.raw`C:\Users\demo\AI\system\openclaw`, |
576 | | - ), |
577 | | - ).toBeUndefined(); |
578 | | - expect( |
579 | | - resolveAllowlistCandidatePath( |
580 | | - { |
581 | | - rawExecutable: String.raw`:/Users/demo/AI/system/openclaw`, |
582 | | - executableName: "openclaw", |
583 | | - }, |
584 | | - String.raw`C:\Users\demo\AI\system\openclaw`, |
585 | | - ), |
586 | | - ).toBeUndefined(); |
| 566 | + withMockedPlatform("win32", () => { |
| 567 | + expect( |
| 568 | + resolveAllowlistCandidatePath( |
| 569 | + { |
| 570 | + rawExecutable: String.raw`:\Users\demo\AI\system\openclaw`, |
| 571 | + executableName: "openclaw", |
| 572 | + }, |
| 573 | + String.raw`C:\Users\demo\AI\system\openclaw`, |
| 574 | + ), |
| 575 | + ).toBeUndefined(); |
| 576 | + expect( |
| 577 | + resolveAllowlistCandidatePath( |
| 578 | + { |
| 579 | + rawExecutable: String.raw`:/Users/demo/AI/system/openclaw`, |
| 580 | + executableName: "openclaw", |
| 581 | + }, |
| 582 | + String.raw`C:\Users\demo\AI\system\openclaw`, |
| 583 | + ), |
| 584 | + ).toBeUndefined(); |
| 585 | + }); |
587 | 586 | }); |
588 | 587 | }); |
0 commit comments