wrap payload for all processors

This commit is contained in:
Joel Wetzell
2026-03-16 17:05:49 -05:00
parent b6c1c5c600
commit f273aedbc6
76 changed files with 674 additions and 486 deletions

View File

@@ -3,6 +3,7 @@ package processor_test
import (
"testing"
"github.com/jwetzell/showbridge-go/internal/common"
"github.com/jwetzell/showbridge-go/internal/config"
"github.com/jwetzell/showbridge-go/internal/processor"
)
@@ -70,7 +71,7 @@ func TestGoodFloatRandom(t *testing.T) {
t.Fatalf("float.random failed to create processor: %s", err)
}
got, err := processorInstance.Process(t.Context(), test.payload)
got, err := processorInstance.Process(t.Context(), common.GetWrappedPayload(t.Context(), test.payload))
if err != nil {
t.Fatalf("float.random processing failed: %s", err)
}
@@ -82,16 +83,16 @@ func TestGoodFloatRandom(t *testing.T) {
var gotFloat float64
if bitSize == 32 {
gotFloat32, ok := got.(float32)
gotFloat32, ok := got.Payload.(float32)
if !ok {
t.Fatalf("float.random returned a %T payload: %s", got, got)
t.Fatalf("float.random returned a %T payload: %+v", got, got)
}
gotFloat = float64(gotFloat32)
}
if bitSize == 64 {
gotFloat64, ok := got.(float64)
gotFloat64, ok := got.Payload.(float64)
if !ok {
t.Fatalf("float.random returned a %T payload: %s", got, got)
t.Fatalf("float.random returned a %T payload: %+v", got, got)
}
gotFloat = gotFloat64
}
@@ -171,10 +172,10 @@ func TestBadFloatRandom(t *testing.T) {
return
}
got, err := processorInstance.Process(t.Context(), test.payload)
got, err := processorInstance.Process(t.Context(), common.GetWrappedPayload(t.Context(), test.payload))
if err == nil {
t.Fatalf("float.random expected to fail but got payload: %s", got)
t.Fatalf("float.random expected to fail but got payload: %+v", got)
}
if err.Error() != test.errorString {