@@ -171,23 +171,21 @@ describe('Transactions', function () {
171171 describe ( 'startTransaction' , function ( ) {
172172 it ( 'should not error if transactions are supported' , {
173173 metadata : { requires : { topology : [ 'sharded' ] } } ,
174- test : function ( done ) {
174+ test : async function ( ) {
175175 const configuration = this . configuration ;
176176 const client = configuration . newClient ( configuration . url ( ) ) ;
177177
178- client . connect ( err => {
179- expect ( err ) . to . not . exist ;
178+ await client . connect ( ) ;
180179
181- const session = client . startSession ( ) ;
182- const db = client . db ( configuration . db ) ;
183- const coll = db . collection ( 'transaction_error_test' ) ;
184- coll . insertOne ( { a : 1 } , err => {
185- expect ( err ) . to . not . exist ;
186- expect ( ( ) => session . startTransaction ( ) ) . to . not . throw ( ) ;
180+ const session = client . startSession ( ) ;
181+ const db = client . db ( configuration . db ) ;
182+ const coll = db . collection ( 'transaction_error_test' ) ;
183+ await coll . insertOne ( { a : 1 } ) ;
184+ session . startTransaction ( ) ;
187185
188- session . abortTransaction ( ( ) => session . endSession ( ( ) => client . close ( done ) ) ) ;
189- } ) ;
190- } ) ;
186+ await session . abortTransaction ( ) ;
187+ await session . endSession ( ) ;
188+ await client . close ( ) ;
191189 }
192190 } ) ;
193191 } ) ;
0 commit comments