Skip to content

Commit 90f3d6f

Browse files
improve test
1 parent 6136777 commit 90f3d6f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

builder/aggregation/aggregation_builder_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ import (
2424
func TestBuilder_AddKeyValues(t *testing.T) {
2525
assert.Equal(t, bson.D{bson.E{Key: "name", Value: "chenmingyong"}}, BsonBuilder().AddKeyValues("name", "chenmingyong").Build())
2626
}
27+
28+
func TestBuilder_tryMergeValue(t *testing.T) {
29+
assert.True(t, BsonBuilder().Push("items", "$item").tryMergeValue("items", bson.E{Key: "$avg", Value: "$items"}))
30+
}

builder/update/array_update_builder_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,25 +649,25 @@ func Test_arrayUpdateBuilder_EachInt(t *testing.T) {
649649

650650
func Test_arrayUpdateBuilder_EachInt8(t *testing.T) {
651651
t.Run("test EachInt8", func(t *testing.T) {
652-
assert.Equal(t, bson.D{bson.E{Key: "$each", Value: []int{99, 98, 97}}}, BsonBuilder().EachInt(99, 98, 97).Build())
652+
assert.Equal(t, bson.D{bson.E{Key: "$each", Value: []int8{99, 98, 97}}}, BsonBuilder().EachInt8(99, 98, 97).Build())
653653
})
654654
}
655655

656656
func Test_arrayUpdateBuilder_EachInt16(t *testing.T) {
657657
t.Run("test EachInt16", func(t *testing.T) {
658-
assert.Equal(t, bson.D{bson.E{Key: "$each", Value: []int{99, 98, 97}}}, BsonBuilder().EachInt(99, 98, 97).Build())
658+
assert.Equal(t, bson.D{bson.E{Key: "$each", Value: []int16{99, 98, 97}}}, BsonBuilder().EachInt16(99, 98, 97).Build())
659659
})
660660
}
661661

662662
func Test_arrayUpdateBuilder_EachInt32(t *testing.T) {
663663
t.Run("test EachInt32", func(t *testing.T) {
664-
assert.Equal(t, bson.D{bson.E{Key: "$each", Value: []int{99, 98, 97}}}, BsonBuilder().EachInt(99, 98, 97).Build())
664+
assert.Equal(t, bson.D{bson.E{Key: "$each", Value: []int32{99, 98, 97}}}, BsonBuilder().EachInt32(99, 98, 97).Build())
665665
})
666666
}
667667

668668
func Test_arrayUpdateBuilder_EachInt64(t *testing.T) {
669669
t.Run("test EachInt64", func(t *testing.T) {
670-
assert.Equal(t, bson.D{bson.E{Key: "$each", Value: []int{99, 98, 97}}}, BsonBuilder().EachInt(99, 98, 97).Build())
670+
assert.Equal(t, bson.D{bson.E{Key: "$each", Value: []int64{99, 98, 97}}}, BsonBuilder().EachInt64(99, 98, 97).Build())
671671
})
672672
}
673673

0 commit comments

Comments
 (0)