add test for loading from registry for all modules

This commit is contained in:
Joel Wetzell
2026-02-09 18:11:08 -06:00
parent a46054c427
commit 86f1082159
16 changed files with 453 additions and 1 deletions

View File

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