Files
commons/assert.go
2026-04-25 10:11:40 -04:00

21 lines
429 B
Go

package commons
import (
"testing"
"bytes"
"go.mongodb.org/mongo-driver/v2/bson"
)
// AssertDeepEqual compares equality by comparing bytes.
func AssertDeepEqual(t *testing.T, expected, actual any) {
t.Helper()
expJSON, _ := bson.MarshalExtJSON(expected, true, true)
actJSON, _ := bson.MarshalExtJSON(actual, true, true)
if !bytes.Equal(expJSON, actJSON) {
t.Fatalf("expected %s, got %s", expJSON, actJSON)
}
}