@@ -174,7 +174,10 @@ describe('useBigInt64 option', function () {
174
174
} ) ;
175
175
176
176
it ( 'throws a BSONError' , async function ( ) {
177
- const e = await db . createCollection ( 'bsonError' ) . catch ( e => e ) ;
177
+ const e = await db
178
+ . aggregate ( [ ] )
179
+ . toArray ( )
180
+ . catch ( e => e ) ;
178
181
expect ( e ) . to . be . instanceOf ( BSON . BSONError ) ;
179
182
} ) ;
180
183
} ) ;
@@ -186,8 +189,11 @@ describe('useBigInt64 option', function () {
186
189
} ) ;
187
190
188
191
it ( 'throws a BSONError' , async function ( ) {
189
- const e = await db
190
- . createCollection ( 'bsonError' , { promoteLongs : false , useBigInt64 : true } )
192
+ const collection = db . collection ( 'bsonError' , { promoteLongs : false , useBigInt64 : true } ) ;
193
+
194
+ const e = await collection
195
+ . insertOne ( { name : 'bailey ' } )
196
+ . then ( ( ) => null )
191
197
. catch ( e => e ) ;
192
198
expect ( e ) . to . be . instanceOf ( BSON . BSONError ) ;
193
199
} ) ;
@@ -233,7 +239,10 @@ describe('useBigInt64 option', function () {
233
239
} ) ;
234
240
235
241
it ( 'throws a BSONError' , async function ( ) {
236
- const e = await db . createCollection ( 'bsonError' ) . catch ( e => e ) ;
242
+ const e = await db
243
+ . aggregate ( [ ] )
244
+ . toArray ( )
245
+ . catch ( e => e ) ;
237
246
expect ( e ) . to . be . instanceOf ( BSON . BSONError ) ;
238
247
} ) ;
239
248
} ) ;
@@ -245,8 +254,11 @@ describe('useBigInt64 option', function () {
245
254
} ) ;
246
255
247
256
it ( 'throws a BSONError' , async function ( ) {
248
- const e = await db
249
- . createCollection ( 'bsonError' , { promoteValues : false , useBigInt64 : true } )
257
+ const collection = db . collection ( 'bsonError' , { promoteValues : false , useBigInt64 : true } ) ;
258
+
259
+ const e = await collection
260
+ . insertOne ( { name : 'bailey ' } )
261
+ . then ( ( ) => null )
250
262
. catch ( e => e ) ;
251
263
expect ( e ) . to . be . instanceOf ( BSON . BSONError ) ;
252
264
} ) ;
0 commit comments