✨ 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:
parent
1110288d84
commit
ebb0b12069
4 changed files with 29 additions and 21 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue