mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
tests for debug.log
This commit is contained in:
39
internal/processor/debug-log_test.go
Normal file
39
internal/processor/debug-log_test.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package processor_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/jwetzell/showbridge-go/internal/config"
|
||||
"github.com/jwetzell/showbridge-go/internal/processor"
|
||||
)
|
||||
|
||||
func TestDebugLogFromRegistry(t *testing.T) {
|
||||
registration, ok := processor.ProcessorRegistry["debug.log"]
|
||||
if !ok {
|
||||
t.Fatalf("debug.log processor not registered")
|
||||
}
|
||||
|
||||
processorInstance, err := registration.New(config.ProcessorConfig{
|
||||
Type: "debug.log",
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create debug.log processor: %s", err)
|
||||
}
|
||||
|
||||
if processorInstance.Type() != "debug.log" {
|
||||
t.Fatalf("debug.log processor has wrong type: %s", processorInstance.Type())
|
||||
}
|
||||
|
||||
payload := "test"
|
||||
expected := "test"
|
||||
|
||||
got, err := processorInstance.Process(t.Context(), payload)
|
||||
if err != nil {
|
||||
t.Fatalf("debug.log processing failed: %s", err)
|
||||
}
|
||||
|
||||
if got != expected {
|
||||
t.Fatalf("debug.log got %+v, expected %+v", got, expected)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user