blob: 87ad35440b79f030d519eb5d9480f9302a054e72 [file] [log] [blame]
Josh Bleecher Snyder64aaf902025-07-31 01:26:16 +00001package server
2
3import (
4 "net/http/httptest"
5 "strings"
6 "testing"
7
8 "sketch.dev/llm"
9)
10
11func TestRenderToolsDebugPage_UsesPre(t *testing.T) {
12 tools := []*llm.Tool{
13 {
14 Name: "test_tool",
15 Description: "This is a test tool\nwith multiple lines\nand formatting",
16 InputSchema: []byte(`{"type": "object"}`),
17 },
18 }
19
20 w := httptest.NewRecorder()
21 renderToolsDebugPage(w, tools)
22 html := w.Body.String()
23
24 // Verify CSS includes pre-wrap styling
25 if !strings.Contains(html, "white-space: pre-wrap") {
26 t.Error("Expected CSS to contain 'white-space: pre-wrap'")
27 }
28 if !strings.Contains(html, "font-family: 'SF Mono', Monaco, monospace") {
29 t.Error("Expected CSS to contain monospace font-family")
30 }
31
32 // Verify HTML uses <pre> tag for tool description
33 if !strings.Contains(html, `<pre class="tool-description">`) {
34 t.Error("Expected HTML to use <pre class=\"tool-description\"> tag")
35 }
36 if strings.Contains(html, `<div class="tool-description">`) {
37 t.Error("Expected HTML to NOT use <div class=\"tool-description\"> tag")
38 }
39
40 // Verify the description content is preserved
41 if !strings.Contains(html, "This is a test tool") {
42 t.Error("Expected tool description to be included")
43 }
44}