Skip to content

Commit

Permalink
feat(jsonx): add test helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Dec 14, 2020
1 parent 845b28b commit 9c1065b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions jsonx/helpers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package jsonx

import (
"encoding/json"
"testing"

"github.com/stretchr/testify/require"
)

func TestMarshalJSONString(t *testing.T, i interface{}) string {
out, err := json.Marshal(i)
require.NoError(t, err)
return string(out)
}

func TestUnmarshalJSON(t *testing.T, in []byte, i interface{}) {
require.NoError(t, json.Unmarshal(in, i))
}

0 comments on commit 9c1065b

Please sign in to comment.