mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-27 05:15:47 +00:00
32 lines
706 B
Go
32 lines
706 B
Go
package module_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/jwetzell/showbridge-go/internal/config"
|
|
"github.com/jwetzell/showbridge-go/internal/module"
|
|
)
|
|
|
|
func TestNATSClientFromRegistry(t *testing.T) {
|
|
registration, ok := module.ModuleRegistry["nats.client"]
|
|
if !ok {
|
|
t.Fatalf("nats.client module not registered")
|
|
}
|
|
|
|
moduleInstance, err := registration.New(config.ModuleConfig{
|
|
Type: "nats.client",
|
|
Params: map[string]any{
|
|
"url": "nats://127.0.0.1:4222",
|
|
"subject": "test",
|
|
},
|
|
})
|
|
|
|
if err != nil {
|
|
t.Fatalf("failed to create nats.client module: %s", err)
|
|
}
|
|
|
|
if moduleInstance.Type() != "nats.client" {
|
|
t.Fatalf("nats.client module has wrong type: %s", moduleInstance.Type())
|
|
}
|
|
}
|