Organize backend into product executable and shared Go modules
This commit is contained in:
1 parent
981e84a4b4
commit
f0720ec66b
382 files changed
+1944
-6989
No files matched your search
@@ -0,0 +1,31 @@
|
||||
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(),
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user