28 lines
561 B
Go
28 lines
561 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestMessageToPersistenceProcessor(t *testing.T) {
|
|
ctx, can := context.WithTimeout(context.Background(), time.Second*10)
|
|
defer can()
|
|
|
|
cases := map[string]string{}
|
|
|
|
for given, wantd := range cases {
|
|
want := wantd
|
|
t.Run(given, func(t *testing.T) {
|
|
process := newMessageToPersistenceProcess(NewTestDriver(t))
|
|
|
|
if got, err := process(ctx, []byte(given)); err != nil {
|
|
t.Fatal(err)
|
|
} else if string(got) != string(want) {
|
|
t.Errorf("wanted %q but got %q", want, got)
|
|
}
|
|
})
|
|
}
|
|
}
|