M5: mDNS - Service-Bekanntmachung (zeroconf) und Discovery
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user