Skip to content

Commit f2f9282

Browse files
feat(updater):
- improve test
1 parent a0d6ed1 commit f2f9282

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

updater/updater_e2e_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func TestUpdater_e2e_UpdateOne(t *testing.T) {
159159
},
160160
ctx: context.Background(),
161161
filter: query.BsonBuilder().Id("456").Build(),
162-
updates: update.BsonBuilder().Set(bsonx.D(bsonx.E("name", "cmy"))).Build(),
162+
updates: update.BsonBuilder().Set("name", "cmy").Build(),
163163
want: &mongo.UpdateResult{MatchedCount: 0, ModifiedCount: 0, UpsertedCount: 0, UpsertedID: nil},
164164
wantErr: func(t assert.TestingT, err error, i ...interface{}) bool {
165165
return assert.NoError(t, err)
@@ -179,7 +179,7 @@ func TestUpdater_e2e_UpdateOne(t *testing.T) {
179179
},
180180
ctx: context.Background(),
181181
filter: query.BsonBuilder().Id("123").Build(),
182-
updates: update.BsonBuilder().Set(bsonx.D(bsonx.E("name", "hhh"))).Build(),
182+
updates: update.BsonBuilder().Set("name", "chenmingyong").Build(),
183183
want: &mongo.UpdateResult{MatchedCount: 1, ModifiedCount: 1, UpsertedCount: 0, UpsertedID: nil},
184184
wantErr: func(t assert.TestingT, err error, i ...interface{}) bool {
185185
return assert.NoError(t, err)
@@ -223,7 +223,7 @@ func TestUpdater_e2e_UpdateOne(t *testing.T) {
223223
},
224224
ctx: context.Background(),
225225
filter: query.BsonBuilder().Id("456").Build(),
226-
updates: update.BsonBuilder().Set(bsonx.D(bsonx.E("name", "cmy"))).Build(),
226+
updates: update.BsonBuilder().Set("name", "cmy").Build(),
227227
opts: []*options.UpdateOptions{
228228
options.Update().SetUpsert(true),
229229
},
@@ -478,7 +478,7 @@ func TestUpdater_e2e_UpdatesWithOperator(t *testing.T) {
478478
operator: types.Set,
479479
ctx: context.Background(),
480480
filter: query.BsonBuilder().Id("456").Build(),
481-
updates: update.BsonBuilder().AddToSet(bsonx.D(bsonx.E("name", "cmy"))).Build(),
481+
updates: update.BsonBuilder().AddToSet("name", "cmy").Build(),
482482
want: &mongo.UpdateResult{MatchedCount: 0, ModifiedCount: 0, UpsertedCount: 0, UpsertedID: nil},
483483
wantErr: func(t assert.TestingT, err error, i ...interface{}) bool {
484484
return assert.NoError(t, err)
@@ -543,7 +543,7 @@ func TestUpdater_e2e_UpdatesWithOperator(t *testing.T) {
543543
ctx: context.Background(),
544544
operator: types.Set,
545545
filter: query.BsonBuilder().Id("456").Build(),
546-
updates: update.BsonBuilder().AddToSet(bsonx.D(bsonx.E("name", "cmy"))).Build(),
546+
updates: update.BsonBuilder().AddToSet("name", "cmy").Build(),
547547
opts: []*options.UpdateOptions{
548548
options.Update().SetUpsert(true),
549549
},

0 commit comments

Comments
 (0)