test(agent): avoid direct terminal dependency

This commit is contained in:
ParthSareen 2026-07-21 17:24:58 -07:00
parent f8527bb734
commit d2e0438b60

View file

@ -11,7 +11,6 @@ import (
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/muesli/termenv"
coreagent "github.com/ollama/ollama/agent"
"github.com/ollama/ollama/api"
@ -2133,10 +2132,6 @@ func TestRenderMarkdownTablePreservesValidSeparator(t *testing.T) {
}
func TestRenderMarkdownCodeFencesHighlightLanguageTaggedCode(t *testing.T) {
profile := lipgloss.ColorProfile()
lipgloss.SetColorProfile(termenv.TrueColor)
defer lipgloss.SetColorProfile(profile)
markdown := strings.Join([]string{
"Use **greet** before running this code.",
"```go",
@ -2172,9 +2167,6 @@ func TestRenderMarkdownCodeFencesHighlightLanguageTaggedCode(t *testing.T) {
if got := markdownCodeTokenKindFor("go", "package", " main"); got != markdownCodeTokenKeyword {
t.Fatalf("package token kind = %v, want keyword", got)
}
if got := highlightMarkdownCodeLine("go", "package main"); !strings.Contains(got, "\x1b[") {
t.Fatalf("language-tagged code should render ANSI syntax styling: %q", got)
}
if got := highlightMarkdownCodeLine("", "plain code stays plain"); got != "plain code stays plain" {
t.Fatalf("untagged code = %q, want plain code", got)
}