@@ -7,14 +7,46 @@ import (
77 "testing"
88)
99
10+ func TestRenderer_Start (t * testing.T ) {
11+ var buf bytes.Buffer
12+ r := New (& buf , true ).WithModel ("deepseek-chat" )
13+
14+ r .Start ("list all files in this directory" )
15+
16+ out := buf .String ()
17+ if ! strings .Contains (out , "kode" ) {
18+ t .Errorf ("Start() missing kode brand: %q" , out )
19+ }
20+ if ! strings .Contains (out , "deepseek-chat" ) {
21+ t .Errorf ("Start() missing model name: %q" , out )
22+ }
23+ if ! strings .Contains (out , "list all files" ) {
24+ t .Errorf ("Start() missing task preview: %q" , out )
25+ }
26+ }
27+
28+ func TestRenderer_Start_LongTask (t * testing.T ) {
29+ var buf bytes.Buffer
30+ r := New (& buf , true ).WithModel ("deepseek-chat" )
31+
32+ longTask := strings .Repeat ("explain this code in great detail " , 10 )
33+ r .Start (longTask )
34+
35+ out := buf .String ()
36+ // Task preview should be truncated to ~80 chars
37+ if strings .Count (out , "explain" ) > 6 {
38+ t .Errorf ("Start() should truncate long task: %q" , out )
39+ }
40+ }
41+
1042func TestRenderer_Iteration (t * testing.T ) {
1143 var buf bytes.Buffer
1244 r := New (& buf , true ).WithModel ("deepseek-chat" )
1345
1446 r .Iteration (3 , 90 )
1547
1648 out := buf .String ()
17- if ! strings .Contains (out , "iter 3/90" ) {
49+ if ! strings .Contains (out , "Iter 3/90" ) {
1850 t .Errorf ("Iteration() missing iteration info: %q" , out )
1951 }
2052 if ! strings .Contains (out , "deepseek-chat" ) {
@@ -29,7 +61,7 @@ func TestRenderer_Iteration_NoModel(t *testing.T) {
2961 r .Iteration (1 , 10 )
3062
3163 out := buf .String ()
32- if ! strings .Contains (out , "iter 1/10" ) {
64+ if ! strings .Contains (out , "Iter 1/10" ) {
3365 t .Errorf ("Iteration() missing iteration info: %q" , out )
3466 }
3567}
@@ -41,12 +73,12 @@ func TestRenderer_Thinking(t *testing.T) {
4173 r .Thinking ("Let me check the file contents first." )
4274
4375 out := buf .String ()
76+ if ! strings .Contains (out , "π§ " ) {
77+ t .Errorf ("Thinking() missing brain emoji: %q" , out )
78+ }
4479 if ! strings .Contains (out , "Let me check the file contents first." ) {
4580 t .Errorf ("Thinking() missing content: %q" , out )
4681 }
47- if ! strings .Contains (out , "thinking" ) {
48- t .Errorf ("Thinking() missing label: %q" , out )
49- }
5082}
5183
5284func TestRenderer_Thinking_Empty (t * testing.T ) {
@@ -67,6 +99,9 @@ func TestRenderer_ToolCall(t *testing.T) {
6799 r .ToolCall ("shell" , `{"command": "ls -la"}` )
68100
69101 out := buf .String ()
102+ if ! strings .Contains (out , "π§" ) {
103+ t .Errorf ("ToolCall() missing wrench emoji: %q" , out )
104+ }
70105 if ! strings .Contains (out , "shell" ) {
71106 t .Errorf ("ToolCall() missing tool name: %q" , out )
72107 }
@@ -83,8 +118,9 @@ func TestRenderer_ToolCall_TruncatedArgs(t *testing.T) {
83118 r .ToolCall ("read" , longArgs )
84119
85120 out := buf .String ()
86- if len (out ) > len (longArgs )+ 100 {
87- t .Errorf ("ToolCall() should truncate long args, got %d chars" , len (out ))
121+ // Args truncated to 100 chars
122+ if strings .Count (out , "x" ) >= 200 {
123+ t .Errorf ("ToolCall() should truncate long args, got %d x chars" , strings .Count (out , "x" ))
88124 }
89125 if ! strings .Contains (out , "β¦" ) {
90126 t .Errorf ("ToolCall() missing truncation ellipsis: %q" , out )
@@ -134,7 +170,7 @@ func TestRenderer_ToolResult_GrayColor(t *testing.T) {
134170 r .ToolResult ("result text" )
135171
136172 out := buf .String ()
137- // Should use gray (dim) , not green
173+ // Should use gray, not green
138174 if strings .Contains (out , green ) {
139175 t .Errorf ("ToolResult() should use gray, not green: %q" , out )
140176 }
@@ -175,12 +211,12 @@ func TestRenderer_FinalAnswer(t *testing.T) {
175211 r .FinalAnswer ("The answer is 42." )
176212
177213 out := buf .String ()
214+ if ! strings .Contains (out , "β
" ) {
215+ t .Errorf ("FinalAnswer() missing check emoji: %q" , out )
216+ }
178217 if ! strings .Contains (out , "The answer is 42." ) {
179218 t .Errorf ("FinalAnswer() missing content: %q" , out )
180219 }
181- if ! strings .Contains (out , "answer" ) {
182- t .Errorf ("FinalAnswer() missing label: %q" , out )
183- }
184220}
185221
186222func TestRenderer_FinalAnswer_Empty (t * testing.T ) {
@@ -201,6 +237,9 @@ func TestRenderer_Error(t *testing.T) {
201237 r .Error (errors .New ("something went wrong" ))
202238
203239 out := buf .String ()
240+ if ! strings .Contains (out , "β" ) {
241+ t .Errorf ("Error() missing cross emoji: %q" , out )
242+ }
204243 if ! strings .Contains (out , "something went wrong" ) {
205244 t .Errorf ("Error() missing message: %q" , out )
206245 }
@@ -227,7 +266,7 @@ func TestRenderer_NoColor(t *testing.T) {
227266 if strings .Contains (out , "\033 [" ) {
228267 t .Errorf ("NoColor should strip ANSI codes, got: %q" , out )
229268 }
230- if ! strings .Contains (out , "iter 1/5" ) {
269+ if ! strings .Contains (out , "Iter 1/5" ) {
231270 t .Errorf ("NoColor should still render text: %q" , out )
232271 }
233272}
@@ -236,6 +275,7 @@ func TestRenderer_NilWriter(t *testing.T) {
236275 r := New (nil , true )
237276
238277 // None of these should panic
278+ r .Start ("task" )
239279 r .Iteration (1 , 5 )
240280 r .Thinking ("hello" )
241281 r .ToolCall ("shell" , "{}" )
@@ -248,6 +288,7 @@ func TestRenderer_NilRenderer(t *testing.T) {
248288 var r * Renderer
249289
250290 // None of these should panic on nil receiver
291+ r .Start ("task" )
251292 r .Iteration (1 , 5 )
252293 r .Thinking ("hello" )
253294 r .ToolCall ("shell" , "{}" )
@@ -260,7 +301,8 @@ func TestRenderer_FullCycle(t *testing.T) {
260301 var buf bytes.Buffer
261302 r := New (& buf , true ).WithModel ("deepseek-chat" )
262303
263- // Simulate one full iteration
304+ // Simulate one full session
305+ r .Start ("what files are here?" )
264306 r .Iteration (1 , 90 )
265307 r .Thinking ("I need to read the file to understand its contents." )
266308 r .ToolCall ("shell" , `{"command": "cat main.go"}` )
@@ -270,11 +312,19 @@ func TestRenderer_FullCycle(t *testing.T) {
270312
271313 out := buf .String ()
272314
273- // Verify each phase is present
274- phases := []string {"iter 1/90" , "thinking" , "shell" , "package main" , "iter 2/90" , "answer" }
275- for _ , phase := range phases {
276- if ! strings .Contains (strings .ToLower (out ), phase ) {
277- t .Errorf ("FullCycle missing phase %q in output:\n %s" , phase , out )
315+ // Verify each phase is present via its emoji
316+ emojis := []string {"π§ " , "π§" , "β
" }
317+ for _ , emoji := range emojis {
318+ if ! strings .Contains (out , emoji ) {
319+ t .Errorf ("FullCycle missing emoji %q in output:\n %s" , emoji , out )
320+ }
321+ }
322+
323+ // Verify key text
324+ texts := []string {"Iter 1/90" , "shell" , "package main" , "Iter 2/90" }
325+ for _ , text := range texts {
326+ if ! strings .Contains (out , text ) {
327+ t .Errorf ("FullCycle missing text %q in output:\n %s" , text , out )
278328 }
279329 }
280330
0 commit comments