released the mock
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/charmbracelet/bubbles/viewport"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
)
|
||||
|
||||
@@ -54,3 +56,18 @@ func TestModelUpdate(t *testing.T) {
|
||||
t.Error("expected message list to grow after response")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMessageWrapping(t *testing.T) {
|
||||
m := initialModel()
|
||||
m.ready = true
|
||||
m.viewport = viewport.New(10, 5) // Very narrow
|
||||
|
||||
longMsg := "This is a very long message that should be wrapped."
|
||||
respModel, _ := m.Update(agentResponseMsg{response: longMsg})
|
||||
rm := respModel.(model)
|
||||
|
||||
lastMsg := rm.messages[len(rm.messages)-1]
|
||||
if !strings.Contains(lastMsg, "\n") {
|
||||
t.Errorf("expected long message to be wrapped, but no newline found")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user