Files
RemLink/cmd/site/console_test.go
T
qsc20001102 142e5dc7d6
ci / Go checks (ubuntu-latest) (push) Has been cancelled
ci / Go checks (windows-latest) (push) Has been cancelled
初版功能完成
2026-08-29 13:12:17 +08:00

28 lines
864 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package main
import (
"bytes"
"net/netip"
"strings"
"testing"
"remlink/internal/model"
)
func TestSiteConsoleShowsRequiredStatusAndEvents(t *testing.T) {
var output bytes.Buffer
console := newSiteConsole(&output)
console.Header("https://server.example", "Site-A", "1.0.0")
console.OverlayReady(netip.MustParseAddr("10.88.0.20"))
console.ControlState(true)
console.SiteReady()
console.Session(model.SessionActive, 42, "")
console.Route(42, netip.MustParsePrefix("192.168.13.0/24"), "DIRECT")
text := output.String()
for _, wanted := range []string{"服务器=", "节点=", "OverlayIP=", "WireGuard=", "Control=", "远程网段=", "子网网关=", "[会话/SESSION]", "活动中(ACTIVE", "[路由/ROUTE]", "直连路由(DIRECT"} {
if !strings.Contains(text, wanted) {
t.Fatalf("console output missing %q: %s", wanted, text)
}
}
}