Add bep.JSON helper for JSON assertion in tests

- Create internal/testutil/bep package with JSON helper
- Use bep.JSON in formatters/json_test.go, models/entry_test.go, and models/meta_test.go
This commit is contained in:
Dan Jones 2026-02-13 16:25:37 -06:00
commit ebb0b12069
4 changed files with 29 additions and 21 deletions

View file

@ -0,0 +1,21 @@
package bep
import (
"encoding/json"
"testing"
"github.com/nalgeon/be"
)
func JSON(t *testing.T, got, want []byte) {
t.Helper()
var gotAny, wantAny any
err := json.Unmarshal(want, &wantAny)
be.Err(t, err, nil)
err = json.Unmarshal(got, &gotAny)
be.Err(t, err, nil)
be.Equal(t, gotAny, wantAny)
}