Files
ratatoskr-go/internal/ui/chat_panel_test.go
ki.sagidullin 5c93642cf8 refactor(ui): вынести панель «Диалог» (ChatPanel) из монолита окна
Спеца 12.12: интерфейс + Nil + FormatRole в internal/ui/chat_panel.go,
Fyne-реализация в internal/ui/desktop/chat_panel.go (транскрипт + композитор).
Окно как chat.Channel рендерит Send/Ask/историю через Append; state_panel
не трогаем.
2026-08-20 23:48:54 +05:00

26 lines
783 B
Go

package ui
import "testing"
// FormatRole — строка роли в диалоге (спец 12.12), pure-функция без Fyne.
func TestFormatRole(t *testing.T) {
if FormatRole("user") != "👤 " {
t.Errorf("user: got %q, want «👤 »", FormatRole("user"))
}
if FormatRole("assistant") != "🤖 " {
t.Errorf("assistant: got %q, want «🤖 »", FormatRole("assistant"))
}
if FormatRole("") != "🤖 " {
t.Errorf("default: got %q, want «🤖 »", FormatRole(""))
}
}
// NilChatPanel — no-op контракт (спец 12.8): безопасно для headless/тестов.
func TestNilChatPanelNoop(t *testing.T) {
p := NewNilChatPanel()
c := NewCommands(nil)
p.SetTranscript("история")
p.Append("строка")
p.Clear()
p.SetCommands(c)
}