Browse Source

update test add wrap error

master
andrey1s 2 years ago
parent
commit
4208f6ab25
  1. 7
      engine/encode_test.go

7
engine/encode_test.go

@ -4,6 +4,7 @@ import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"testing"
@ -19,7 +20,11 @@ func TestEncodeLoad(t *testing.T) {
buff := bytes.Buffer{}
exec, err := engine.NewEncode("json", func(w io.Writer, v interface{}) error {
return json.NewEncoder(w).Encode(v)
if err := json.NewEncoder(w).Encode(v); err != nil {
return fmt.Errorf("%w", err)
}
return nil
}).Load(ctx, render.NewReference("any"))
require.NoError(t, err)
require.NoError(t, exec(ctx, &buff, map[string]string{"name": "json data"}, nil))

Loading…
Cancel
Save