22 lines
366 B
Go
22 lines
366 B
Go
package mongo
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
)
|
|
|
|
func TestGetFieldsToIgnore(t *testing.T) {
|
|
got := getFieldsToIgnore([]string{"field1", "field2"})
|
|
|
|
expected := fmt.Sprintf("%+v", bson.M{
|
|
"field1": 0,
|
|
"field2": 0,
|
|
})
|
|
|
|
if fmt.Sprintf("%+v", got) != expected {
|
|
t.Errorf("getFieldsToIgnore = %+v; want %s", got, expected)
|
|
}
|
|
}
|