Skip to content

Commit

Permalink
[httpassert] Add test helper for printing JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
georgepsarakis committed Oct 1, 2024
1 parent a408f29 commit aaf7ec9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
6 changes: 0 additions & 6 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,3 @@ func TestClient_Get_JSON(t *testing.T) {
require.NoError(t, DeserializeJSON(resp, &v))
require.JSONEq(t, responseBody, string(MustInterceptResponseBody(resp)))
}

func printJSON(t *testing.T, v any) {
b, err := json.MarshalIndent(v, "", " ")
require.NoError(t, err)
t.Log(string(b))
}
14 changes: 14 additions & 0 deletions httpassert/debug.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package httpassert

import (
"encoding/json"
"testing"

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

func PrintJSON(t *testing.T, v any) {
b, err := json.MarshalIndent(v, "", " ")
require.NoError(t, err)
t.Log(string(b))
}

0 comments on commit aaf7ec9

Please sign in to comment.