claude-web-chat/ws_test.go
djuka adea7ca28d
Some checks failed
Tests / unit-tests (push) Failing after 43s
Zamena chat UI sa pravim terminalom (xterm.js + PTY)
- Dodat creack/pty za pseudo-terminal podršku
- Claude CLI se pokreće u pravom PTY-ju (puni TUI, boje, Shift+Tab)
- xterm.js u browseru renderuje terminal identično konzoli
- WebSocket bridge: tastatura → PTY stdin, PTY stdout → terminal
- Ring buffer (128KB) za replay pri reconnect-u
- Automatski reconnect nakon 2 sekunde
- PTY sesije žive nezavisno od browsera (60min idle timeout)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 05:54:40 +00:00

34 lines
683 B
Go

package main
import (
"encoding/json"
"testing"
)
func TestResizeMsgParsing(t *testing.T) {
msg := `{"type":"resize","cols":120,"rows":40}`
var r resizeMsg
if err := json.Unmarshal([]byte(msg), &r); err != nil {
t.Fatal(err)
}
if r.Type != "resize" {
t.Errorf("got type %q", r.Type)
}
if r.Cols != 120 {
t.Errorf("got cols %d", r.Cols)
}
if r.Rows != 40 {
t.Errorf("got rows %d", r.Rows)
}
}
func TestResizeMsgNotInput(t *testing.T) {
// Regular keyboard input should NOT parse as resize
msg := []byte("hello")
var r resizeMsg
err := json.Unmarshal(msg, &r)
if err == nil && r.Type == "resize" {
t.Error("regular input should not parse as resize")
}
}