@@ -259,6 +259,8 @@ test('fastify.pg.test use transact util with promise', t => {
259259
260260 const fastify = Fastify ( )
261261
262+ t . tearDown ( fastify . close . bind ( fastify ) )
263+
262264 fastify . register ( fastifyPostgres , {
263265 name : 'test' ,
264266 connectionString : 'postgres://postgres@localhost/postgres'
@@ -274,15 +276,12 @@ test('fastify.pg.test use transact util with promise', t => {
274276 . query ( `SELECT * FROM users WHERE username = 'with-promise'` )
275277 . then ( result => {
276278 t . ok ( result . rows [ 0 ] . username === 'with-promise' )
277- fastify . close ( )
278279 } ) . catch ( err => {
279280 t . fail ( err )
280- fastify . close ( )
281281 } )
282282 } )
283283 . catch ( err => {
284284 t . fail ( err )
285- fastify . close ( )
286285 } )
287286 } )
288287} )
@@ -291,6 +290,7 @@ test('fastify.pg.test use transact util with callback', t => {
291290 t . plan ( 4 )
292291
293292 const fastify = Fastify ( )
293+ t . tearDown ( fastify . close . bind ( fastify ) )
294294
295295 fastify . register ( fastifyPostgres , {
296296 name : 'test' ,
@@ -309,10 +309,8 @@ test('fastify.pg.test use transact util with callback', t => {
309309 . query ( `SELECT * FROM users WHERE username = 'with-callback'` )
310310 . then ( result => {
311311 t . ok ( result . rows [ 0 ] . username === 'with-callback' )
312- fastify . close ( )
313312 } ) . catch ( err => {
314313 t . fail ( err )
315- fastify . close ( )
316314 } )
317315 } )
318316 } )
@@ -322,6 +320,7 @@ test('fastify.pg.test use transact util with commit callback', t => {
322320 t . plan ( 4 )
323321
324322 const fastify = Fastify ( )
323+ t . tearDown ( fastify . close . bind ( fastify ) )
325324
326325 fastify . register ( fastifyPostgres , {
327326 name : 'test' ,
@@ -343,10 +342,8 @@ test('fastify.pg.test use transact util with commit callback', t => {
343342 . query ( `SELECT * FROM users WHERE username = 'commit-callback'` )
344343 . then ( result => {
345344 t . ok ( result . rows [ 0 ] . username === 'commit-callback' )
346- fastify . close ( )
347345 } ) . catch ( err => {
348346 t . fail ( err )
349- fastify . close ( )
350347 } )
351348 } )
352349 } )
0 commit comments