summaryrefslogtreecommitdiff
path: root/internal/api
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-05-02 22:10:48 -1000
committerGitHub <noreply@github.com>2026-05-02 22:10:48 -1000
commitb32bfe1bc6bcbc45d7d1549d6ae6412bc3e4424f (patch)
tree4dc822097b7f32a37ad655a550da1abada79ce85 /internal/api
parent1ec3f87c392145580a62858110d9fd10638203db (diff)
parente7b382bf177cbe518af3d86c3ee6c49344d225f4 (diff)
Merge pull request #3 from thepeterstone/claude/deferred-work
Close deferred work — real GeminiRunner subprocess, Local UI option
Diffstat (limited to 'internal/api')
-rw-r--r--internal/api/server_test.go23
1 files changed, 12 insertions, 11 deletions
diff --git a/internal/api/server_test.go b/internal/api/server_test.go
index 516e289..2139e36 100644
--- a/internal/api/server_test.go
+++ b/internal/api/server_test.go
@@ -143,20 +143,21 @@ func testServerWithGeminiMockRunner(t *testing.T) (*Server, *storage.DB) {
logger := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelDebug}))
- // Create the mock gemini binary script.
+ // Create the mock gemini binary script. Use single-quoted heredoc so
+ // bash does not try to evaluate the literal backticks as command
+ // substitution.
mockBinDir := t.TempDir()
mockGeminiPath := filepath.Join(mockBinDir, "mock-gemini-binary.sh")
mockScriptContent := `#!/bin/bash
-OUTPUT_FILE=$(mktemp)
-echo "` + "```json" + `" > "$OUTPUT_FILE"
-echo "{\"type\":\"content_block_start\",\"content_block\":{\"text\":\"Hello, Gemini!\",\"type\":\"text\"}}" >> "$OUTPUT_FILE"
-echo "{\"type\":\"content_block_delta\",\"content_block\":{\"text\":\" How are you?\"}}" >> "$OUTPUT_FILE"
-echo "{\"type\":\"content_block_end\"}" >> "$OUTPUT_FILE"
-echo "{\"type\":\"message_delta\",\"message\":{\"role\":\"model\"}}" >> "$OUTPUT_FILE"
-echo "{\"type\":\"message_end\"}" >> "$OUTPUT_FILE"
-echo "` + "```" + `" >> "$OUTPUT_FILE"
-cat "$OUTPUT_FILE"
-rm "$OUTPUT_FILE"
+cat <<'EOF'
+` + "```json" + `
+{"type":"content_block_start","content_block":{"text":"Hello, Gemini!","type":"text"}}
+{"type":"content_block_delta","content_block":{"text":" How are you?"}}
+{"type":"content_block_end"}
+{"type":"message_delta","message":{"role":"model"}}
+{"type":"message_end"}
+` + "```" + `
+EOF
exit 0
`
if err := os.WriteFile(mockGeminiPath, []byte(mockScriptContent), 0755); err != nil {