mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-27 13:25:40 +00:00
add test for loading from registry for all modules
This commit is contained in:
30
internal/module/test/http-server_test.go
Normal file
30
internal/module/test/http-server_test.go
Normal 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 TestHTTPServerFromRegistry(t *testing.T) {
|
||||
registration, ok := module.ModuleRegistry["http.server"]
|
||||
if !ok {
|
||||
t.Fatalf("http.server module not registered")
|
||||
}
|
||||
|
||||
moduleInstance, err := registration.New(config.ModuleConfig{
|
||||
Type: "http.server",
|
||||
Params: map[string]any{
|
||||
"port": 3000.0,
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create http.server module: %s", err)
|
||||
}
|
||||
|
||||
if moduleInstance.Type() != "http.server" {
|
||||
t.Fatalf("http.server module has wrong type: %s", moduleInstance.Type())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user