Skip to content

Commit 6868f54

Browse files
committed
test: make DCG ZIP extraction platform-aware
1 parent 9ee5400 commit 6868f54

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/services/destructive-command-guard/__tests__/manager.spec.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,13 @@ describe("Destructive Command Guard manager", () => {
110110
child.emit("close", 0)
111111
await extraction
112112

113-
expect(mockSpawn).toHaveBeenCalledWith("unzip", ["-o", "C:\\dcg.zip", "-d", "C:\\staging"], {
113+
const expectedExecutable = process.platform === "win32" ? "powershell" : "unzip"
114+
const expectedArgs =
115+
process.platform === "win32"
116+
? ["-NoProfile", "-Command", "Expand-Archive -Path 'C:\\dcg.zip' -DestinationPath 'C:\\staging' -Force"]
117+
: ["-o", "C:\\dcg.zip", "-d", "C:\\staging"]
118+
119+
expect(mockSpawn).toHaveBeenCalledWith(expectedExecutable, expectedArgs, {
114120
shell: false,
115121
stdio: ["ignore", "pipe", "pipe"],
116122
})

0 commit comments

Comments
 (0)