package builderimp import ( "testing" "git.sendico.io/tech/sxchnge/shared/database/repository/builder" "github.com/stretchr/testify/require" "go.mongodb.org/mongo-driver/v2/bson" ) func TestEmptySetComparisonsRemainBSONArrays(t *testing.T) { field := NewFieldImp("organizationRef") require.Equal(t, bson.D{{Key: "organizationRef", Value: bson.M{string(builder.NotIn): []any{}}}}, NewQueryImp().NotIn(field).BuildQuery(), ) require.Equal(t, bson.D{{Key: "organizationRef", Value: bson.M{string(builder.In): []any{}}}}, NewQueryImp().In(field).BuildQuery(), ) } func TestSetComparisonsAcceptNilElements(t *testing.T) { field := NewFieldImp("organizationRef") require.Equal(t, bson.D{{Key: "organizationRef", Value: bson.M{string(builder.NotIn): []any{"", nil}}}}, NewQueryImp().NotIn(field, "", nil).BuildQuery(), ) }