Files
showbridge-go/internal/module/test/tcp-server_test.go
2026-02-09 18:17:42 -06:00

37 lines
834 B
Go

package module_test
import (
"testing"
"github.com/jwetzell/showbridge-go/internal/config"
"github.com/jwetzell/showbridge-go/internal/module"
)
func TestTCPServerFromRegistry(t *testing.T) {
registration, ok := module.ModuleRegistry["net.tcp.server"]
if !ok {
t.Fatalf("net.tcp.server module not registered")
}
moduleInstance, err := registration.New(config.ModuleConfig{
Id: "test",
Type: "net.tcp.server",
Params: map[string]any{
"port": 8000.0,
"framing": "LF",
},
})
if err != nil {
t.Fatalf("failed to create net.tcp.server module: %s", err)
}
if moduleInstance.Id() != "test" {
t.Fatalf("net.tcp.server module has wrong id: %s", moduleInstance.Id())
}
if moduleInstance.Type() != "net.tcp.server" {
t.Fatalf("net.tcp.server module has wrong type: %s", moduleInstance.Type())
}
}