From 2d9fc27f110e5200577c676ae083ae964007afe2 Mon Sep 17 00:00:00 2001 From: OfrenDialsa Date: Sat, 6 Dec 2025 10:33:12 +0700 Subject: [PATCH] fix: end pool for putlike and like repository test --- nginx.conf | 4 ++-- src/Applications/use_case/_test/PutLikeUseCase.test.js | 4 +++- .../repository/_test/LikeRepositoryPostgres.test.js | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/nginx.conf b/nginx.conf index 511ac1e..193c385 100644 --- a/nginx.conf +++ b/nginx.conf @@ -50,9 +50,9 @@ server { proxy_cache_bypass $http_upgrade; } - location /threads/ { + location /threads { limit_req zone=threads_limit burst=20 nodelay; - proxy_pass http://localhost:5000; + proxy_pass http://localhost:5000$request_uri; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; diff --git a/src/Applications/use_case/_test/PutLikeUseCase.test.js b/src/Applications/use_case/_test/PutLikeUseCase.test.js index d06ee83..e9905c2 100644 --- a/src/Applications/use_case/_test/PutLikeUseCase.test.js +++ b/src/Applications/use_case/_test/PutLikeUseCase.test.js @@ -1,3 +1,4 @@ +const pool = require('../../../Infrastructures/database/postgres/pool'); const CommentsTableTestHelper = require('../../../../tests/CommentsTableTestHelper'); const LikesTableTestHelper = require('../../../../tests/LikesTableTestHelper'); const ThreadsTableTestHelper = require('../../../../tests/ThreadsTableTestHelper'); @@ -6,7 +7,6 @@ const CommentRepository = require('../../../Domains/comments/CommentRepository') const NewLike = require('../../../Domains/likes/entities/NewLike'); const LikeRepository = require('../../../Domains/likes/LikeRepository'); const ThreadRepository = require('../../../Domains/threads/ThreadRepository'); - const PutLikeUseCase = require('../PutLikeUseCase'); describe('PutLikeUseCase',()=>{ @@ -21,6 +21,8 @@ describe('PutLikeUseCase',()=>{ await ThreadsTableTestHelper.cleanTable(); await CommentsTableTestHelper.cleanTable(); await LikesTableTestHelper.cleanTable(); + + await pool.end(); }); it('should orchestrating the add like action correctly',async()=>{ diff --git a/src/Infrastructures/repository/_test/LikeRepositoryPostgres.test.js b/src/Infrastructures/repository/_test/LikeRepositoryPostgres.test.js index 1d8cd80..e215a2a 100644 --- a/src/Infrastructures/repository/_test/LikeRepositoryPostgres.test.js +++ b/src/Infrastructures/repository/_test/LikeRepositoryPostgres.test.js @@ -23,6 +23,8 @@ describe('LikeRepositoryPostgres',()=>{ await UsersTableTestHelper.cleanTable(); await ThreadsTableTestHelper.cleanTable(); await CommentsTableTestHelper.cleanTable(); + + await pool.end(); }); describe('add like function', ()=>{