Add BsonDFromSlice, Add AssertDeepEqual
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user