| 1 | package cli |
| 2 | |
| 3 | import ( |
| 4 | "strings" |
| 5 | "testing" |
| 6 | |
| 7 | "reasonix/internal/event" |
| 8 | ) |
| 9 | |
| 10 | func TestIngestEventPrintsWebSearchFootnotesAfterAnswer(t *testing.T) { |
| 11 | m := newTestChatTUI() |
| 12 | m.ingestEvent(event.Event{Kind: event.ToolResult, Tool: event.Tool{ |
| 13 | Name: "web_search", Output: "Change Log\nhttps://api-docs.deepseek.com/updates/", |
| 14 | }}) |
| 15 | if len(*m.pendingCommit) != 0 { |
| 16 | t.Fatalf("search result should stay silent until the answer, committed=%v", *m.pendingCommit) |
| 17 | } |
| 18 | m.ingestEvent(event.Event{Kind: event.Text, Text: "answer only"}) |
| 19 | m.ingestEvent(event.Event{Kind: event.Message, Text: "answer only"}) |
| 20 | got := strings.Join(*m.pendingCommit, "\n") |
| 21 | if !strings.Contains(got, "answer only") || !strings.Contains(got, "Change Log") || !strings.Contains(got, "https://api-docs.deepseek.com/updates/") { |
| 22 | t.Fatalf("committed=%q, want answer then title/url footnotes", got) |
| 23 | } |
| 24 | } |
| 25 |