package agent
import "testing"
func TestStripThinkingTags_RedactedThinking(t *testing.T) {
tests := []struct {
name string
input string
want string
}{
{
name: "strips redacted_thinking tags",
input: "Hello secret reasoning world",
want: "Hello world",
},
{
name: "strips redacted_thinking with attributes",
input: `Before hidden after`,
want: "Before after",
},
{
name: "strips redacted_thinking with whitespace in closing tag",
input: "A x B",
want: "A B",
},
{
name: "strips redacted_thinking multiline content",
input: "Start\n\nline1\nline2\n\nEnd",
want: "Start\n\nEnd",
},
{
name: "content with only redacted_thinking (no other thinking tags)",
input: "all hidden",
want: "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := stripThinkingTags(tt.input)
if got != tt.want {
t.Errorf("stripThinkingTags() = %q, want %q", got, tt.want)
}
})
}
}
func TestStripThinkingTags_ExistingPatterns(t *testing.T) {
tests := []struct {
name string
input string
want string
}{
{
name: "strips think tags",
input: "Hello reasoning world",
want: "Hello world",
},
{
name: "strips thinking tags",
input: "A step by step B",
want: "A B",
},
{
name: "strips thought tags",
input: "A hmm B",
want: "A B",
},
{
name: "strips antThinking tags",
input: "A internal B",
want: "A B",
},
{
name: "strips think with attributes",
input: `A stuff B`,
want: "A B",
},
{
name: "no thinking tags — returns unchanged",
input: "Just normal content here",
want: "Just normal content here",
},
{
name: "mixed redacted_thinking and think",
input: "a middle b",
want: "middle",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := stripThinkingTags(tt.input)
if got != tt.want {
t.Errorf("stripThinkingTags() = %q, want %q", got, tt.want)
}
})
}
}
func TestSanitizeAssistantContent_RedactedThinking(t *testing.T) {
input := "Hello secret world"
got := SanitizeAssistantContent(input)
if got != "Hello world" {
t.Errorf("SanitizeAssistantContent() = %q, want %q", got, "Hello world")
}
}