-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathfrontend_setup_scripts_test.go
More file actions
551 lines (495 loc) · 18.3 KB
/
Copy pathfrontend_setup_scripts_test.go
File metadata and controls
551 lines (495 loc) · 18.3 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
package main
import (
"io/fs"
"net/http"
"net/http/httptest"
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
"time"
)
func TestServeCodexSetupScript_PowerShell(t *testing.T) {
h := &proxyHandler{}
req := httptest.NewRequest(http.MethodGet, "http://example.com/setup/codex/testtoken?shell=powershell", nil)
rr := httptest.NewRecorder()
h.serveCodexSetupScript(rr, req)
if rr.Code != http.StatusOK {
t.Fatalf("status = %d, want %d", rr.Code, http.StatusOK)
}
if ct := rr.Header().Get("Content-Type"); !strings.HasPrefix(ct, "text/plain") {
t.Fatalf("Content-Type = %q, want text/plain*", ct)
}
body := rr.Body.String()
if !strings.Contains(body, "Set-StrictMode -Version Latest") {
t.Fatalf("expected PowerShell script body, got:\n%s", body)
}
if !strings.Contains(body, "Join-Path $HOME '.codex'") {
t.Fatalf("expected codex paths in script body, got:\n%s", body)
}
if !strings.Contains(body, "model_catalog_json = ") {
t.Fatalf("expected model catalog config in script body, got:\n%s", body)
}
if !strings.Contains(body, "[mcp_servers.model_sync]") {
t.Fatalf("expected MCP sidecar config in script body, got:\n%s", body)
}
if !strings.Contains(body, "model_sync.ps1") {
t.Fatalf("expected MCP sidecar script install in PowerShell body, got:\n%s", body)
}
if !strings.Contains(body, "$firstLine = [Console]::In.ReadLine()") {
t.Fatalf("expected MCP JSONL transport support in PowerShell body, got:\n%s", body)
}
}
func TestServeCodexSetupScript_Bash(t *testing.T) {
h := &proxyHandler{}
req := httptest.NewRequest(http.MethodGet, "http://example.com/setup/codex/testtoken", nil)
rr := httptest.NewRecorder()
h.serveCodexSetupScript(rr, req)
if rr.Code != http.StatusOK {
t.Fatalf("status = %d, want %d", rr.Code, http.StatusOK)
}
if ct := rr.Header().Get("Content-Type"); !strings.HasPrefix(ct, "text/x-shellscript") {
t.Fatalf("Content-Type = %q, want text/x-shellscript*", ct)
}
body := rr.Body.String()
if !strings.Contains(body, "model_sync.sh") {
t.Fatalf("expected MCP sidecar script install in bash body, got:\n%s", body)
}
if !strings.Contains(body, "model_catalog_json = ") {
t.Fatalf("expected model catalog config in bash script body, got:\n%s", body)
}
if !strings.Contains(body, "[mcp_servers.model_sync]") {
t.Fatalf("expected MCP sidecar config in bash script body, got:\n%s", body)
}
if !strings.Contains(body, "MCP_TRANSPORT_MODE=\"jsonl\"") {
t.Fatalf("expected MCP JSONL transport support in bash body, got:\n%s", body)
}
}
func TestServeGrokSetupScript_Bash(t *testing.T) {
h := &proxyHandler{}
req := httptest.NewRequest(http.MethodGet, "http://example.com/setup/grok/testtoken", nil)
rr := httptest.NewRecorder()
h.serveGrokSetupScript(rr, req)
if rr.Code != http.StatusOK {
t.Fatalf("status = %d, want %d", rr.Code, http.StatusOK)
}
body := rr.Body.String()
for _, want := range []string{"[endpoints]", `models_base_url = \"`, `[model."%s"]`, "grok-build", "gpt-5.6-luna", "claude-sonnet-5", "auth.json.before-codex-pool", "/config/grok/$TOKEN"} {
if !strings.Contains(body, want) {
t.Fatalf("expected Grok setup script to contain %q", want)
}
}
}
func TestServeGrokSetupScript_PowerShell(t *testing.T) {
h := &proxyHandler{}
req := httptest.NewRequest(http.MethodGet, "http://example.com/setup/grok/testtoken?shell=powershell", nil)
rr := httptest.NewRecorder()
h.serveGrokSetupScript(rr, req)
if rr.Code != http.StatusOK || !strings.Contains(rr.Body.String(), "models_base_url") || !strings.Contains(rr.Body.String(), "[model.\"' + $Model.Id + '\"]") {
t.Fatalf("PowerShell Grok setup missing proxy endpoint or model credentials: status=%d", rr.Code)
}
}
func TestServeGrokSetupScript_BashPreservesConfigAndIsIdempotent(t *testing.T) {
h := &proxyHandler{}
req := httptest.NewRequest(http.MethodGet, "http://example.com/setup/grok/testtoken", nil)
rr := httptest.NewRecorder()
h.serveGrokSetupScript(rr, req)
home := t.TempDir()
configDir := filepath.Join(home, ".grok")
if err := os.MkdirAll(configDir, 0o700); err != nil {
t.Fatal(err)
}
configFile := filepath.Join(configDir, "config.toml")
initial := "[cli]\nauto_update = true\n\n[models]\ndefault = \"grok-build\"\n"
if err := os.WriteFile(configFile, []byte(initial), 0o600); err != nil {
t.Fatal(err)
}
authFile := filepath.Join(configDir, "auth.json")
if err := os.WriteFile(authFile, []byte(`{"oauth":"credential"}`), 0o600); err != nil {
t.Fatal(err)
}
binDir := filepath.Join(home, "bin")
if err := os.MkdirAll(binDir, 0o700); err != nil {
t.Fatal(err)
}
fakeCurl := "#!/bin/sh\nprintf '%s\\n' '{\"api_key\":\"pool-jwt\"}'\n"
if err := os.WriteFile(filepath.Join(binDir, "curl"), []byte(fakeCurl), 0o700); err != nil {
t.Fatal(err)
}
for range 2 {
cmd := exec.Command("bash")
cmd.Stdin = strings.NewReader(rr.Body.String())
cmd.Env = append(os.Environ(), "HOME="+home, "PATH="+binDir+":"+os.Getenv("PATH"))
if output, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("run installer: %v\n%s", err, output)
}
}
data, err := os.ReadFile(configFile)
if err != nil {
t.Fatal(err)
}
config := string(data)
for _, want := range []string{"[cli]", "auto_update = true", `default = "grok-build"`, `[endpoints]`, `models_base_url = "http://example.com/v1"`, `api_key = "pool-jwt"`} {
if !strings.Contains(config, want) {
t.Fatalf("installed config missing %q:\n%s", want, config)
}
}
if strings.Contains(config, "codex-pool-grok") {
t.Fatalf("installer must not create or select a synthetic model:\n%s", config)
}
if count := strings.Count(config, `[model."grok-build"]`); count != 1 {
t.Fatalf("grok-build credential override count = %d, want 1:\n%s", count, config)
}
if _, err := os.Stat(authFile); !os.IsNotExist(err) {
t.Fatalf("active Grok OAuth file still exists: %v", err)
}
if _, err := os.Stat(filepath.Join(configDir, "auth.json.before-codex-pool")); err != nil {
t.Fatalf("Grok OAuth backup missing: %v", err)
}
}
func TestServePiSetupScriptMergesProviders(t *testing.T) {
h := &proxyHandler{}
for _, target := range []string{
"http://example.com/setup/pi/testtoken",
"http://example.com/setup/pi/testtoken?shell=powershell",
} {
req := httptest.NewRequest(http.MethodGet, target, nil)
rr := httptest.NewRecorder()
h.servePiSetupScript(rr, req)
if rr.Code != http.StatusOK {
t.Fatalf("%s status = %d", target, rr.Code)
}
body := rr.Body.String()
if !strings.Contains(body, "/config/pi/testtoken") || !strings.Contains(body, "providers") {
t.Fatalf("%s did not generate a merging Pi installer", target)
}
}
}
func TestServeGeminiSetupScript_PowerShell(t *testing.T) {
secret := "test-secret-key-12345678901234567890"
t.Setenv("POOL_JWT_SECRET", secret)
tmpDir := t.TempDir()
usersPath := filepath.Join(tmpDir, "pool_users.json")
store, err := newPoolUserStore(usersPath)
if err != nil {
t.Fatalf("newPoolUserStore: %v", err)
}
user := &PoolUser{
ID: "user123",
Token: "tok123",
Email: "test@example.com",
PlanType: "pro",
CreatedAt: time.Now(),
}
if err := store.Create(user); err != nil {
t.Fatalf("create user: %v", err)
}
h := &proxyHandler{poolUsers: store}
req := httptest.NewRequest(http.MethodGet, "http://example.com/setup/gemini/tok123?shell=powershell", nil)
rr := httptest.NewRecorder()
h.serveGeminiSetupScript(rr, req)
if rr.Code != http.StatusOK {
t.Fatalf("status = %d, want %d", rr.Code, http.StatusOK)
}
if ct := rr.Header().Get("Content-Type"); !strings.HasPrefix(ct, "text/plain") {
t.Fatalf("Content-Type = %q, want text/plain*", ct)
}
body := rr.Body.String()
if !strings.Contains(body, "$env:CODE_ASSIST_ENDPOINT = $BaseUrl") {
t.Fatalf("expected PowerShell env setup in body, got:\n%s", body)
}
if strings.Contains(body, "`") {
t.Fatalf("PowerShell script should not contain backticks (Go raw string safety), got:\n%s", body)
}
}
func newTestPoolUserStoreWithUser(t *testing.T, token string) *PoolUserStore {
t.Helper()
tmpDir := t.TempDir()
usersPath := filepath.Join(tmpDir, "pool_users.json")
store, err := newPoolUserStore(usersPath)
if err != nil {
t.Fatalf("newPoolUserStore: %v", err)
}
user := &PoolUser{ID: "user-" + token, Token: token, Email: token + "@example.com", PlanType: "pro", CreatedAt: time.Now()}
if err := store.Create(user); err != nil {
t.Fatalf("create user: %v", err)
}
return store
}
func TestServeCuteCodeLanding(t *testing.T) {
h := &proxyHandler{}
req := httptest.NewRequest(http.MethodGet, "http://example.com/cute-code", nil)
rr := httptest.NewRecorder()
h.serveCuteCodeLanding(rr, req)
if rr.Code != http.StatusOK {
t.Fatalf("status = %d, want %d", rr.Code, http.StatusOK)
}
body := rr.Body.String()
for _, want := range []string{"codex pool + cute-code", "Generate setup", "cute-code --model gpt-5.6-sol"} {
if !strings.Contains(body, want) {
t.Fatalf("expected cute-code landing to contain %q, got:\n%s", want, body)
}
}
}
func TestFriendLandingServesReactSignalRoom(t *testing.T) {
h := &proxyHandler{cfg: &config{friendCode: "peepee"}}
req := httptest.NewRequest(http.MethodGet, "http://example.com/", nil)
rr := httptest.NewRecorder()
h.serveFriendLanding(rr, req)
if rr.Code != http.StatusOK {
t.Fatalf("status = %d, want %d", rr.Code, http.StatusOK)
}
body := rr.Body.String()
for _, want := range []string{
`<div id="root"></div>`,
`AI Pool — Full-Spectrum Signal Room`,
`src="/assets/`,
`href="/assets/`,
} {
if !strings.Contains(body, want) {
t.Fatalf("expected React signal room to contain %q", want)
}
}
for _, unwanted := range []string{`id="access-form"`, `onclick="switchSubTab`, `id="codex-add-section"`} {
if strings.Contains(body, unwanted) {
t.Fatalf("React shell still contains legacy friend markup %q", unwanted)
}
}
}
func TestFriendCodeIsNotEmbeddedInPublicSignalRoom(t *testing.T) {
const secret = "friend-secret-that-must-never-ship"
h := &proxyHandler{cfg: &config{friendCode: secret}}
page := httptest.NewRecorder()
h.serveFriendLanding(page, httptest.NewRequest(http.MethodGet, "http://example.com/", nil))
if strings.Contains(page.Body.String(), secret) {
t.Fatal("friend code leaked into public HTML")
}
if err := fs.WalkDir(signalRoomContent, "web/dist", func(path string, entry fs.DirEntry, err error) error {
if err != nil || entry.IsDir() {
return err
}
data, err := signalRoomContent.ReadFile(path)
if err != nil {
return err
}
if strings.Contains(string(data), secret) {
t.Fatalf("friend code leaked into embedded asset %s", path)
}
return nil
}); err != nil {
t.Fatal(err)
}
}
func TestServeSignalRoomAsset(t *testing.T) {
h := &proxyHandler{cfg: &config{friendCode: "peepee"}}
page := httptest.NewRecorder()
h.serveFriendLanding(page, httptest.NewRequest(http.MethodGet, "http://example.com/", nil))
body := page.Body.String()
start := strings.Index(body, `src="/assets/`)
if start < 0 {
t.Fatal("signal room script asset missing")
}
start += len(`src="`)
end := strings.Index(body[start:], `"`)
if end < 0 {
t.Fatal("signal room script asset is malformed")
}
assetPath := body[start : start+end]
rr := httptest.NewRecorder()
h.serveSignalRoomAsset(rr, httptest.NewRequest(http.MethodGet, "http://example.com"+assetPath, nil))
if rr.Code != http.StatusOK || rr.Body.Len() == 0 {
t.Fatalf("asset response status=%d bytes=%d", rr.Code, rr.Body.Len())
}
if got := rr.Header().Get("Content-Type"); !strings.Contains(got, "javascript") {
t.Fatalf("Content-Type = %q, want JavaScript", got)
}
if got := rr.Header().Get("Cache-Control"); !strings.Contains(got, "immutable") {
t.Fatalf("Cache-Control = %q, want immutable", got)
}
}
func TestServeHeroImageWebP(t *testing.T) {
h := &proxyHandler{}
req := httptest.NewRequest(http.MethodGet, "http://example.com/hero.webp", nil)
rr := httptest.NewRecorder()
h.serveHeroImage(rr, req)
if rr.Code != http.StatusOK {
t.Fatalf("status = %d, want %d", rr.Code, http.StatusOK)
}
if got := rr.Header().Get("Content-Type"); got != "image/webp" {
t.Fatalf("Content-Type = %q, want image/webp", got)
}
body := rr.Body.Bytes()
if len(body) < 12 || string(body[:4]) != "RIFF" || string(body[8:12]) != "WEBP" {
t.Fatalf("hero response is not WebP: %q", body[:min(len(body), 12)])
}
}
func TestServeCuteCodeSetupScript_Bash(t *testing.T) {
secret := "test-secret-key-12345678901234567890"
t.Setenv("POOL_JWT_SECRET", secret)
t.Setenv("PUBLIC_URL", "")
h := &proxyHandler{poolUsers: newTestPoolUserStoreWithUser(t, "tok-cute")}
req := httptest.NewRequest(http.MethodGet, "http://example.com/setup/cute-code/tok-cute", nil)
rr := httptest.NewRecorder()
h.serveCuteCodeSetupScript(rr, req)
if rr.Code != http.StatusOK {
t.Fatalf("status = %d, want %d", rr.Code, http.StatusOK)
}
body := rr.Body.String()
for _, want := range []string{
"https://git.irrigate.cc/pp/cute-code/raw/branch/main/install.sh",
"/config/cute-code/tok-cute",
"CLAUDE_DIR=\"${CLAUDE_CONFIG_DIR:-$HOME/.claude}\"",
"cute-code --model gpt-5.6-sol",
} {
if !strings.Contains(body, want) {
t.Fatalf("expected cute-code bash setup to contain %q, got:\n%s", want, body)
}
}
}
func TestServeCuteCodeSetupScript_PowerShell(t *testing.T) {
secret := "test-secret-key-12345678901234567890"
t.Setenv("POOL_JWT_SECRET", secret)
t.Setenv("PUBLIC_URL", "")
h := &proxyHandler{poolUsers: newTestPoolUserStoreWithUser(t, "tok-cute-ps")}
req := httptest.NewRequest(http.MethodGet, "http://example.com/setup/cute-code/tok-cute-ps?shell=powershell", nil)
rr := httptest.NewRecorder()
h.serveCuteCodeSetupScript(rr, req)
if rr.Code != http.StatusOK {
t.Fatalf("status = %d, want %d", rr.Code, http.StatusOK)
}
body := rr.Body.String()
for _, want := range []string{
"https://git.irrigate.cc/pp/cute-code/raw/branch/main/install.ps1",
"/config/cute-code/tok-cute-ps",
"$claudeDir = $env:CLAUDE_CONFIG_DIR",
"cute-code --model gpt-5.6-sol",
} {
if !strings.Contains(body, want) {
t.Fatalf("expected cute-code PowerShell setup to contain %q, got:\n%s", want, body)
}
}
}
func TestServeCuteCodeSettingsConfig(t *testing.T) {
secret := "test-secret-key-12345678901234567890"
t.Setenv("POOL_JWT_SECRET", secret)
t.Setenv("PUBLIC_URL", "")
h := &proxyHandler{poolUsers: newTestPoolUserStoreWithUser(t, "tok-cute-config")}
req := httptest.NewRequest(http.MethodGet, "http://example.com/config/cute-code/tok-cute-config", nil)
rr := httptest.NewRecorder()
h.serveCuteCodeSettingsConfig(rr, req)
if rr.Code != http.StatusOK {
t.Fatalf("status = %d, want %d", rr.Code, http.StatusOK)
}
body := rr.Body.String()
for _, want := range []string{
`"openaiBaseUrl": "http://example.com"`,
`"anthropicBaseUrl": "http://example.com"`,
`"openaiApiKey": "sk-ant-oat01-pool-`,
`"model": "gpt-5.6-sol"`,
`"id": "gpt-5.6-sol"`,
`"id": "gpt-5.5"`,
`"id": "claude-fable-5"`,
`"id": "claude-opus-4-8"`,
`"id": "MiniMax-M3"`,
`"id": "MiniMax-M2.7"`,
`"id": "glm-5.2"`,
} {
if !strings.Contains(body, want) {
t.Fatalf("expected cute-code config to contain %q, got:\n%s", want, body)
}
}
for _, forbidden := range []string{"remoteCompactForAnthropic", "remoteCompactModel"} {
if strings.Contains(body, forbidden) {
t.Fatalf("cute-code config should not contain %q, got:\n%s", forbidden, body)
}
}
}
func TestServeClaudeSetupScript_BashClearsConflictingClaudeAuth(t *testing.T) {
secret := "test-secret-key-12345678901234567890"
t.Setenv("POOL_JWT_SECRET", secret)
t.Setenv("PUBLIC_URL", "")
tmpDir := t.TempDir()
usersPath := filepath.Join(tmpDir, "pool_users.json")
store, err := newPoolUserStore(usersPath)
if err != nil {
t.Fatalf("newPoolUserStore: %v", err)
}
user := &PoolUser{ID: "user789", Token: "tok789", Email: "test3@example.com", PlanType: "pro", CreatedAt: time.Now()}
if err := store.Create(user); err != nil {
t.Fatalf("create user: %v", err)
}
h := &proxyHandler{poolUsers: store}
req := httptest.NewRequest(http.MethodGet, "http://example.com/setup/claude/tok789", nil)
rr := httptest.NewRecorder()
h.serveClaudeSetupScript(rr, req)
if rr.Code != http.StatusOK {
t.Fatalf("status = %d, want %d", rr.Code, http.StatusOK)
}
body := rr.Body.String()
for _, want := range []string{
"CONFLICTING_ENV_VARS=(",
"unset ANTHROPIC_AUTH_TOKEN",
"unset ANTHROPIC_API_KEY",
"CLAUDE_DIR=\"${CLAUDE_CONFIG_DIR:-$HOME/.claude}\"",
"delete settings.apiKeyHelper;",
"settings.pop('apiKeyHelper', None)",
} {
if !strings.Contains(body, want) {
t.Fatalf("expected bash script to contain %q, got:\n%s", want, body)
}
}
}
func TestServeClaudeSetupScript_PowerShell(t *testing.T) {
secret := "test-secret-key-12345678901234567890"
t.Setenv("POOL_JWT_SECRET", secret)
// Ensure env is not contaminated by user-specific settings during test runs.
t.Setenv("PUBLIC_URL", "")
tmpDir := t.TempDir()
usersPath := filepath.Join(tmpDir, "pool_users.json")
store, err := newPoolUserStore(usersPath)
if err != nil {
t.Fatalf("newPoolUserStore: %v", err)
}
user := &PoolUser{
ID: "user456",
Token: "tok456",
Email: "test2@example.com",
PlanType: "pro",
CreatedAt: time.Now(),
}
if err := store.Create(user); err != nil {
t.Fatalf("create user: %v", err)
}
h := &proxyHandler{poolUsers: store}
req := httptest.NewRequest(http.MethodGet, "http://example.com/setup/claude/tok456?shell=powershell", nil)
rr := httptest.NewRecorder()
h.serveClaudeSetupScript(rr, req)
if rr.Code != http.StatusOK {
t.Fatalf("status = %d, want %d", rr.Code, http.StatusOK)
}
if ct := rr.Header().Get("Content-Type"); !strings.HasPrefix(ct, "text/plain") {
t.Fatalf("Content-Type = %q, want text/plain*", ct)
}
body := rr.Body.String()
if !strings.Contains(body, "$env:ANTHROPIC_BASE_URL = $BaseUrl") {
t.Fatalf("expected PowerShell env setup in body, got:\n%s", body)
}
for _, want := range []string{
"[Environment]::SetEnvironmentVariable('CLAUDE_CODE_OAUTH_TOKEN', $OAuthToken, 'User')",
"[Environment]::SetEnvironmentVariable($name, $null, 'User')",
"Remove-ObjectProperty -Object $settings -Name 'apiKeyHelper'",
"foreach ($name in $conflictingEnvVars) { Remove-ObjectProperty -Object $envObj -Name $name }",
"$claudeDir = $env:CLAUDE_CONFIG_DIR",
} {
if !strings.Contains(body, want) {
t.Fatalf("expected PowerShell script to contain %q, got:\n%s", want, body)
}
}
if !strings.Contains(body, "ConvertTo-Json -Depth 10") {
t.Fatalf("expected PowerShell JSON update logic in body, got:\n%s", body)
}
if strings.Contains(body, "`") {
t.Fatalf("PowerShell script should not contain backticks (Go raw string safety), got:\n%s", body)
}
}