@@ -41,7 +41,6 @@ describe('nodeify', () => {
4141assert . ifError ( err )
4242assert . equal ( result . $reql_type$ , 'TIME' )
4343} )
44-
4544await connection . close ( )
4645} )
4746
@@ -72,31 +71,21 @@ describe('nodeify', () => {
7271it ( 'Testing conn.close with a callback - 1' , async function ( ) {
7372await r . connect ( config , function ( err , conn ) {
7473assert . ifError ( err )
75- conn . close ( function ( err , conn ) {
76- assert . ifError ( err )
77- assert ( ! conn )
78- } )
74+ conn . close ( )
7975} )
8076} )
8177
8278it ( 'Testing conn.close with a callback - 2' , async function ( ) {
8379await r . connect ( config , function ( err , conn ) {
8480assert . ifError ( err )
85- conn . close ( { noreplyWait :true } , function ( err , conn ) {
86- // This may or may not succeed, depending on the config file
87- assert . ifError ( err )
88- assert ( ! conn )
89- } )
81+ conn . close ( { noreplyWait :true } , assert . ifError )
9082} )
9183} )
9284
9385it ( 'Testing conn.noreplyWait with a callback' , async function ( ) {
9486await r . connect ( config , function ( err , conn ) {
9587assert . ifError ( err )
96- return conn . noreplyWait ( ( ) => {
97- // This may or may not succeed, depending on the config file
98- conn . close ( )
99- } )
88+ conn . noreplyWait ( ( ) => conn . close ( ) )
10089} )
10190} )
10291} )
@@ -119,11 +108,8 @@ describe('nodeify', () => {
119108
120109it ( 'Testing valid syntax for `run` - 5' , async function ( ) {
121110const result = await r_ . now ( ) . run ( function ( err , result ) {
122- if ( err ) {
123- throw err
124- } else {
125- return result
126- }
111+ assert . ifError ( err )
112+ return result
127113} )
128114assert ( result instanceof Date )
129115} )
@@ -151,31 +137,23 @@ describe('nodeify', () => {
151137cursor . next ( function ( err , result ) {
152138assert . ifError ( err )
153139assert . deepEqual ( result , 1 )
154- cursor . close ( ) . catch ( assert . ifError )
155140} )
156141} )
157142} )
158143
159144it ( 'Testing cursor.close with a callback' , async function ( ) {
160145await r_ . expr ( [ 1 , 2 , 3 ] ) . run ( { cursor :true } , function ( err , cursor ) {
161146assert . ifError ( err )
162- cursor . close ( function ( err , conn ) {
163- assert . ifError ( err )
164- assert ( ! conn )
165- } )
147+ cursor . close ( )
166148} )
167149} )
168150
169151it ( 'Testing cursor.close with a callback when already closed' , async function ( ) {
170- r_ . expr ( [ 1 , 2 , 3 ] ) . run ( { cursor :true } , function ( err , cursor ) {
152+ await r_ . expr ( [ 1 , 2 , 3 ] ) . run ( { cursor :true } , function ( err , cursor ) {
171153assert . ifError ( err )
172- cursor . close ( function ( err , conn ) {
154+ cursor . close ( function ( err ) {
173155assert . ifError ( err )
174- assert ( ! conn )
175- cursor . close ( function ( err , conn ) {
176- assert . ifError ( err )
177- assert ( ! conn )
178- } )
156+ cursor . close ( )
179157} )
180158} )
181159} )