Skip to content

Commit f6faa1e

Browse files
committed
Use require.Greater instead of an if.
1 parent ed8c663 commit f6faa1e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

internal/integration/collection_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"go.mongodb.org/mongo-driver/v2/event"
1616
"go.mongodb.org/mongo-driver/v2/internal/assert"
1717
"go.mongodb.org/mongo-driver/v2/internal/integration/mtest"
18+
"go.mongodb.org/mongo-driver/v2/internal/require"
1819
"go.mongodb.org/mongo-driver/v2/mongo"
1920
"go.mongodb.org/mongo-driver/v2/mongo/options"
2021
"go.mongodb.org/mongo-driver/v2/mongo/writeconcern"
@@ -238,10 +239,7 @@ func TestCollection(t *testing.T) {
238239
gotCode := we.WriteErrors[0].Code
239240
assert.Equal(mt, errorDuplicateKey, gotCode, "expected error code %v, got %v", errorDuplicateKey, gotCode)
240241

241-
if len(res.InsertedIDs) == 0 {
242-
mt.Fatal("Expected at least one inserted ID")
243-
}
244-
242+
require.Greater(mt, len(res.InsertedIDs), 0, "expected at least one inserted ID")
245243
assert.Equal(mt,
246244
tc.numInserted,
247245
len(res.InsertedIDs),

0 commit comments

Comments
 (0)