@@ -258,6 +258,7 @@ test('fastify.pg.test use transact util with promise', t => {
258258 t . plan ( 3 )
259259
260260 const fastify = Fastify ( )
261+ t . tearDown ( fastify . close . bind ( fastify ) )
261262
262263 fastify . register ( fastifyPostgres , {
263264 name : 'test' ,
@@ -274,15 +275,12 @@ test('fastify.pg.test use transact util with promise', t => {
274275 . query ( `SELECT * FROM users WHERE username = 'with-promise'` )
275276 . then ( result => {
276277 t . ok ( result . rows [ 0 ] . username === 'with-promise' )
277- fastify . close ( )
278278 } ) . catch ( err => {
279279 t . fail ( err )
280- fastify . close ( )
281280 } )
282281 } )
283282 . catch ( err => {
284283 t . fail ( err )
285- fastify . close ( )
286284 } )
287285 } )
288286} )
@@ -291,6 +289,7 @@ test('fastify.pg.test use transact util with callback', t => {
291289 t . plan ( 4 )
292290
293291 const fastify = Fastify ( )
292+ t . tearDown ( fastify . close . bind ( fastify ) )
294293
295294 fastify . register ( fastifyPostgres , {
296295 name : 'test' ,
@@ -309,10 +308,8 @@ test('fastify.pg.test use transact util with callback', t => {
309308 . query ( `SELECT * FROM users WHERE username = 'with-callback'` )
310309 . then ( result => {
311310 t . ok ( result . rows [ 0 ] . username === 'with-callback' )
312- fastify . close ( )
313311 } ) . catch ( err => {
314312 t . fail ( err )
315- fastify . close ( )
316313 } )
317314 } )
318315 } )
@@ -322,6 +319,7 @@ test('fastify.pg.test use transact util with commit callback', t => {
322319 t . plan ( 4 )
323320
324321 const fastify = Fastify ( )
322+ t . tearDown ( fastify . close . bind ( fastify ) )
325323
326324 fastify . register ( fastifyPostgres , {
327325 name : 'test' ,
@@ -343,10 +341,8 @@ test('fastify.pg.test use transact util with commit callback', t => {
343341 . query ( `SELECT * FROM users WHERE username = 'commit-callback'` )
344342 . then ( result => {
345343 t . ok ( result . rows [ 0 ] . username === 'commit-callback' )
346- fastify . close ( )
347344 } ) . catch ( err => {
348345 t . fail ( err )
349- fastify . close ( )
350346 } )
351347 } )
352348 } )
0 commit comments