forked from code-yeongyu/oh-my-openagent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodex-process.test.ts
More file actions
81 lines (65 loc) · 2.38 KB
/
Copy pathcodex-process.test.ts
File metadata and controls
81 lines (65 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/// <reference path="../../../../bun-test.d.ts" />
import { describe, expect, test } from "bun:test"
import { resolveRunCommandInvocation } from "./codex-process"
describe("codex-process", () => {
test("#given Windows npm command #when resolving run command invocation #then uses cmd shim", () => {
// given
const command = "npm"
const args = ["install", "--omit=dev"] as const
// when
const invocation = resolveRunCommandInvocation(command, args, "win32")
// then
expect(invocation).toEqual({
command: "cmd.exe",
args: ["/d", "/s", "/c", "npm.cmd", "install", "--omit=dev"],
})
})
test("#given non-Windows npm command #when resolving run command invocation #then preserves direct execution", () => {
// given
const command = "npm"
const args = ["install", "--omit=dev"] as const
// when
const invocation = resolveRunCommandInvocation(command, args, "linux")
// then
expect(invocation).toEqual({
command: "npm",
args: ["install", "--omit=dev"],
})
})
test("#given Windows codex command #when resolving run command invocation #then uses cmd shim so the npm-installed codex.cmd resolves instead of ENOENT", () => {
// given
const command = "codex"
const args = ["exec", "--ephemeral", "diagnose"] as const
// when
const invocation = resolveRunCommandInvocation(command, args, "win32")
// then
expect(invocation).toEqual({
command: "cmd.exe",
args: ["/d", "/s", "/c", "codex.cmd", "exec", "--ephemeral", "diagnose"],
})
})
test("#given non-Windows codex command #when resolving run command invocation #then preserves direct execution", () => {
// given
const command = "codex"
const args = ["exec", "--ephemeral", "diagnose"] as const
// when
const invocation = resolveRunCommandInvocation(command, args, "linux")
// then
expect(invocation).toEqual({
command: "codex",
args: ["exec", "--ephemeral", "diagnose"],
})
})
test("#given Windows non-shim command #when resolving run command invocation #then preserves direct execution", () => {
// given
const command = "git"
const args = ["status", "--short"] as const
// when
const invocation = resolveRunCommandInvocation(command, args, "win32")
// then
expect(invocation).toEqual({
command: "git",
args: ["status", "--short"],
})
})
})