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

@ -7,6 +7,7 @@ import (
"testing"
"time"
"codeberg.org/danjones000/my-log/internal/testutil/bep"
"github.com/nalgeon/be"
)
@ -103,10 +104,7 @@ func TestMetasJson(t *testing.T) {
exp := `{"me":41,"you":false}`
o, err := json.Marshal(ms)
be.Err(t, err, nil)
var got, want any
json.Unmarshal([]byte(exp), &want)
json.Unmarshal(o, &got)
be.Equal(t, got, want)
bep.JSON(t, o, []byte(exp))
}
func TestMetasJsonUnmarshal(t *testing.T) {