mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-27 05:15:47 +00:00
test cleanup
This commit is contained in:
@@ -80,7 +80,6 @@ func TestBadStringDecode(t *testing.T) {
|
|||||||
errorString string
|
errorString string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
processor: &stringDecoder,
|
|
||||||
name: "non-[]byte input",
|
name: "non-[]byte input",
|
||||||
payload: "hello",
|
payload: "hello",
|
||||||
errorString: "string.decode processor only accepts a []byte",
|
errorString: "string.decode processor only accepts a []byte",
|
||||||
@@ -89,7 +88,7 @@ func TestBadStringDecode(t *testing.T) {
|
|||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
got, err := test.processor.Process(t.Context(), test.payload)
|
got, err := stringDecoder.Process(t.Context(), test.payload)
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("string.decode expected to fail but got payload: %s", got)
|
t.Fatalf("string.decode expected to fail but got payload: %s", got)
|
||||||
|
|||||||
@@ -47,13 +47,11 @@ func TestStringEncodeFromRegistry(t *testing.T) {
|
|||||||
func TestGoodStringEncode(t *testing.T) {
|
func TestGoodStringEncode(t *testing.T) {
|
||||||
stringEncoder := processor.StringEncode{}
|
stringEncoder := processor.StringEncode{}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
processor processor.Processor
|
|
||||||
name string
|
name string
|
||||||
payload any
|
payload any
|
||||||
expected []byte
|
expected []byte
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
processor: &stringEncoder,
|
|
||||||
name: "hello",
|
name: "hello",
|
||||||
payload: "hello",
|
payload: "hello",
|
||||||
expected: []byte{0x68, 0x65, 0x6c, 0x6c, 0x6f},
|
expected: []byte{0x68, 0x65, 0x6c, 0x6c, 0x6f},
|
||||||
@@ -62,7 +60,7 @@ func TestGoodStringEncode(t *testing.T) {
|
|||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
got, err := test.processor.Process(t.Context(), test.payload)
|
got, err := stringEncoder.Process(t.Context(), test.payload)
|
||||||
|
|
||||||
gotBytes, ok := got.([]byte)
|
gotBytes, ok := got.([]byte)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
Reference in New Issue
Block a user