Closed maliyan closed 4 years ago
testdata/foo.golden
{ "foo": 1, "bar": 3 }
foo_test.go
package main import ( "testing" "github.com/sebdah/goldie/v2" ) func TestFoo(t *testing.T) { g := goldie.New(t) g.AssertJson(t, "something", `{"foo": 1, "bar": 2}`) }
test failed === RUN TestFoo foo_test.go:12: Result did not match the golden fixture. Diff is below:
test failed
=== RUN TestFoo foo_test.go:12: Result did not match the golden fixture. Diff is below:
--- Expected +++ Actual @@ -1,5 +1 @@ -{ - "foo": 1, - "bar": 3 -} - +"{\"foo\": 1, \"bar\": 2}"
--- FAIL: TestFoo (0.00s)
This is because you have new lines in your test data, which is not there in the input data. To make sure they align you can run go test -update ./..., or update the test data file.
go test -update ./...
--- FAIL: TestFoo (0.00s)