Skip to content

Commit 863b1d0

Browse files
committed
modify: 코드래빗 리뷰 반영
1 parent 1202fd2 commit 863b1d0

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/repositories/__test__/leaderboard.repo.integration.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,10 @@ describe('LeaderboardRepository 통합 테스트', () => {
7272

7373
afterAll(async () => {
7474
try {
75-
// 모든 쿼리 완료 대기
76-
await new Promise((resolve) => setTimeout(resolve, 500));
75+
jest.clearAllMocks();
7776

7877
// 풀 완전 종료
79-
if (testPool) {
80-
// 강제 종료: 모든 활성 쿼리와 연결 중지
81-
await testPool.end();
82-
}
78+
await testPool.end();
8379

8480
logger.info('LeaderboardRepository 통합 테스트 DB 연결 종료');
8581
} catch (error) {

src/repositories/leaderboard.repository.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ export class LeaderboardRepository {
5252
p.released_at,
5353
COALESCE(ts.today_view, 0)::int AS total_views,
5454
COALESCE(ts.today_like, 0)::int AS total_likes,
55-
COALESCE(ts.today_view, 0) - COALESCE(ss.start_view, COALESCE(ts.today_view, 0))::int AS view_diff,
56-
COALESCE(ts.today_like, 0) - COALESCE(ss.start_like, COALESCE(ts.today_like, 0))::int AS like_diff
55+
(COALESCE(ts.today_view, 0) - COALESCE(ss.start_view, COALESCE(ts.today_view, 0)))::int AS view_diff,
56+
(COALESCE(ts.today_like, 0) - COALESCE(ss.start_like, COALESCE(ts.today_like, 0)))::int AS like_diff
5757
FROM posts_post p
5858
LEFT JOIN today_stats ts ON ts.post_id = p.id
5959
LEFT JOIN start_stats ss ON ss.post_id = p.id

0 commit comments

Comments
 (0)