Break down the 627-line handlers.go into specialized modules: - handlers_chat.go: chat and streaming endpoints - handlers_config.go: configuration endpoints - handlers_common.go: shared utilities - handlers_info.go: info and status endpoints - handlers_terminal.go: terminal/shell endpoints - handlers_tools.go: tool-related endpoints Also includes config improvements, orchestrator enhancements, and web component updates. 💘 Generated with Crush Assisted-by: MiniMax-M2.7 via Crush <crush@charm.land>
53 lines
940 B
Go
53 lines
940 B
Go
package platform
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestDetect(t *testing.T) {
|
|
info := Detect()
|
|
if info.OS == "" {
|
|
t.Error("OS should not be empty")
|
|
}
|
|
if info.Arch == "" {
|
|
t.Error("Arch should not be empty")
|
|
}
|
|
if info.Shell == "" {
|
|
t.Error("Shell should not be empty")
|
|
}
|
|
}
|
|
|
|
func TestDetectShell(t *testing.T) {
|
|
shell := detectShell()
|
|
if shell == "" {
|
|
t.Error("Shell should not be empty")
|
|
}
|
|
}
|
|
|
|
func TestDetectPackageManager(t *testing.T) {
|
|
mgr := detectPackageManager("unknown")
|
|
if mgr != "unknown" {
|
|
t.Errorf("Unknown OS should return unknown package manager, got %s", mgr)
|
|
}
|
|
}
|
|
|
|
func TestString(t *testing.T) {
|
|
info := SystemInfo{
|
|
OS: Linux,
|
|
Arch: AMD64,
|
|
Shell: "bash",
|
|
Terminal: "unknown",
|
|
PackageManager: "apt",
|
|
}
|
|
s := info.String()
|
|
if s == "" {
|
|
t.Error("String should not be empty")
|
|
}
|
|
if !strings.Contains(s, "linux") {
|
|
t.Error("Should contain OS")
|
|
}
|
|
}
|
|
|
|
|