Files

33 lines
718 B
Go

package mdns
import (
"testing"
)
func TestGetServiceName(t *testing.T) {
expected := "_sportscore._tcp"
got := GetServiceName()
if got != expected {
t.Errorf("GetServiceName() = %q, want %q", got, expected)
}
}
func TestDiscoveryResult(t *testing.T) {
result := &DiscoveryResult{
Instance: "test-scoreboard",
Host: "myhost.local",
Port: 3000,
Addr: "192.168.1.100:3000",
}
if result.Instance != "test-scoreboard" {
t.Errorf("Instance = %q, want %q", result.Instance, "test-scoreboard")
}
if result.Port != 3000 {
t.Errorf("Port = %d, want 3000", result.Port)
}
if result.Addr != "192.168.1.100:3000" {
t.Errorf("Addr = %q, want %q", result.Addr, "192.168.1.100:3000")
}
}