11/* eslint-disable @typescript-eslint/no-empty-function */
22import { expect } from 'chai' ;
33
4+ import { type Collection , type FindCursor , type MongoClient } from '../../mongodb' ;
45import { type TestConfiguration } from '../../tools/runner/config' ;
56import { runScriptAndGetProcessInfo } from './resource_tracking_script_builder' ;
67
@@ -699,16 +700,24 @@ describe('MongoClient.close() Integration', () => {
699700
700701 describe ( 'Server resource: Cursor' , ( ) => {
701702 describe ( 'after cursors are created' , ( ) => {
702- let client ;
703- let coll ;
704- let cursor ;
705- let utilClient ;
703+ let client : MongoClient ;
704+ let coll : Collection ;
705+ let cursor : FindCursor ;
706+ let utilClient : MongoClient ;
706707
707708 beforeEach ( async function ( ) {
708709 client = this . configuration . newClient ( ) ;
709710 utilClient = this . configuration . newClient ( ) ;
710711 await client . connect ( ) ;
711- coll = await client . db ( 'db' ) . collection ( 'coll' , { capped : true , size : 1_000_000 } ) ;
712+ await client
713+ . db ( 'db' )
714+ . collection ( 'coll' )
715+ ?. drop ( )
716+ . catch ( ( ) => null ) ;
717+ coll = await client
718+ . db ( 'db' )
719+ . createCollection ( 'coll' , { capped : true , size : 1_000 , max : 4 } ) ;
720+ await coll . insertMany ( [ { a : 1 } , { b : 2 } , { c : 3 } ] ) ;
712721 } ) ;
713722
714723 afterEach ( async function ( ) {
@@ -717,7 +726,7 @@ describe('MongoClient.close() Integration', () => {
717726 await cursor ?. close ( ) ;
718727 } ) ;
719728
720- it . skip ( 'all active server-side cursors are closed by client.close()' , async function ( ) {
729+ it ( 'all active server-side cursors are closed by client.close()' , async function ( ) {
721730 const getCursors = async ( ) => {
722731 const res = await utilClient
723732 . db ( )
@@ -732,8 +741,7 @@ describe('MongoClient.close() Integration', () => {
732741 ) ;
733742 } ;
734743
735- await coll . insertMany ( [ { a : 1 } , { b : 2 } , { c : 3 } ] ) ;
736- cursor = await coll . find (
744+ cursor = coll . find (
737745 { } ,
738746 {
739747 tailable : true ,
0 commit comments