Add BsonDFromSlice, Add AssertDeepEqual

This commit is contained in:
George Suntres
2026-04-25 10:11:40 -04:00
parent 28dcfb9e4c
commit 13c75f62b1
3 changed files with 66 additions and 2 deletions

View File

@@ -3,8 +3,26 @@ package commons
import (
"fmt"
"testing"
"go.mongodb.org/mongo-driver/v2/bson"
)
func TestBsonDFromSlice(t *testing.T) {
in := [][]any{
{"first", -1},
{"second", 1},
}
d := BsonDFromSlice(in)
expected := bson.D{
{Key: "first", Value: -1},
{Key: "second", Value: 1},
}
AssertDeepEqual(t, d, expected)
}
func TestStructHasProperty(t *testing.T) {
type O struct {
Name string