Skip to content

Commit

Permalink
Merge pull request #36 from sebdah/revert-35-patch-1
Browse files Browse the repository at this point in the history
Revert "Do not escape JSON"
  • Loading branch information
sebdah authored Nov 17, 2020
2 parents 927dbef + ba18026 commit 9788822
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions v2/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,14 @@ func (g *Goldie) Assert(t *testing.T, name string, actualData []byte) {
// `a-z0-9\-\_` is a good idea).
func (g *Goldie) AssertJson(t *testing.T, name string, actualJsonData interface{}) {
t.Helper()
buf := &bytes.Buffer{}
enc := json.NewEncoder(buf)
enc.SetIndent("", " ")
enc.SetEscapeHTML(false)
err := enc.Encode(actualJsonData)
js, err := json.MarshalIndent(actualJsonData, "", " ")

if err != nil {
t.Error(err)
t.FailNow()
}

g.Assert(t, name, normalizeLF(buf.Bytes()))
g.Assert(t, name, normalizeLF(js))
}

// AssertXml compares the actual xml data received with expected data in the
Expand Down

0 comments on commit 9788822

Please sign in to comment.