add test for loading from registry for rest of processors

This commit is contained in:
Joel Wetzell
2026-02-09 17:42:16 -06:00
parent f91cb9dbbf
commit 9dc4706fd8
25 changed files with 733 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
package processor_test
import (
"testing"
"github.com/jwetzell/showbridge-go/internal/config"
"github.com/jwetzell/showbridge-go/internal/processor"
)
func TestMQTTMessageCreateFromRegistry(t *testing.T) {
registration, ok := processor.ProcessorRegistry["mqtt.message.create"]
if !ok {
t.Fatalf("mqtt.message.create processor not registered")
}
processorInstance, err := registration.New(config.ProcessorConfig{
Type: "mqtt.message.create",
Params: map[string]any{
"topic": "test/topic",
"payload": "Hello, World!",
"qos": 1.0,
"retained": true,
},
})
if err != nil {
t.Fatalf("failed to create mqtt.message.create processor: %s", err)
}
if processorInstance.Type() != "mqtt.message.create" {
t.Fatalf("mqtt.message.create processor has wrong type: %s", processorInstance.Type())
}
}