diff --git a/__tests__/api/challenge-claim-api.test.ts b/__tests__/api/challenge-claim-api.test.ts index f6b4791..e468760 100644 --- a/__tests__/api/challenge-claim-api.test.ts +++ b/__tests__/api/challenge-claim-api.test.ts @@ -39,7 +39,7 @@ describe('/api/challenge/claim', () => { }); describe('POST', () => { - it('should return 401 when not authenticated', async () => { + it('인증되지 않은 경우 401을 반환한다', async () => { mockGetServerSession.mockResolvedValue(null); const request = new Request('http://localhost/api/challenge/claim', { @@ -54,7 +54,7 @@ describe('/api/challenge/claim', () => { expect(data.message).toBe('Unauthorized'); }); - it('should return 400 when challengeId is missing', async () => { + it('challengeId가 없는 경우 400을 반환한다', async () => { mockGetServerSession.mockResolvedValue({ user: { id: '1' }, }); @@ -71,7 +71,7 @@ describe('/api/challenge/claim', () => { expect(data.message).toBe('Challenge ID is required'); }); - it('should successfully claim challenge reward', async () => { + it('챌린지 보상을 정상적으로 수령하면 200을 반환한다', async () => { mockGetServerSession.mockResolvedValue({ user: { id: '1' }, }); @@ -111,7 +111,7 @@ describe('/api/challenge/claim', () => { ); }); - it('should return 500 when cannot claim challenge', async () => { + it('보상을 받을 수 없는 챌린지인 경우 500을 반환한다', async () => { mockGetServerSession.mockResolvedValue({ user: { id: '1' }, }); @@ -138,7 +138,7 @@ describe('/api/challenge/claim', () => { expect(data.message).toBe('Already claimed'); }); - it('should return 400 when claim service returns failure', async () => { + it('보상 처리 중 실패한 경우 400을 반환한다', async () => { mockGetServerSession.mockResolvedValue({ user: { id: '1' }, }); @@ -166,7 +166,7 @@ describe('/api/challenge/claim', () => { expect(data.message).toBe('ISA account not found'); }); - it('should handle unexpected errors', async () => { + it('예상치 못한 오류가 발생하면 500을 반환한다', async () => { mockGetServerSession.mockResolvedValue({ user: { id: '1' }, }); diff --git a/__tests__/services/challenge-claim.test.ts b/__tests__/services/challenge-claim.test.ts index 36ea1d5..1ace22b 100644 --- a/__tests__/services/challenge-claim.test.ts +++ b/__tests__/services/challenge-claim.test.ts @@ -20,7 +20,7 @@ describe('Challenge Claim Service', () => { mockTx = createChallengePrismaMock(); }); - it('should successfully claim ONCE type challenge reward', async () => { + it('ONCE 타입 챌린지 보상을 정상적으로 수령한다', async () => { // Arrange const mockChallenge = { id: challengeId, @@ -88,7 +88,7 @@ describe('Challenge Claim Service', () => { expect(mockTx.userChallengeProgress.updateMany).not.toHaveBeenCalled(); }); - it('should successfully claim DAILY type challenge reward and reset progress', async () => { + it('DAILY 타입 챌린지 보상을 정상적으로 수령하고 진행도를 초기화한다', async () => { // Arrange const mockChallenge = { id: challengeId, @@ -140,7 +140,7 @@ describe('Challenge Claim Service', () => { }); }); - it('should return error when challenge not found', async () => { + it('챌린지를 찾을 수 없으면 에러를 반환한다', async () => { mockTx.challenge.findUnique.mockResolvedValue(null); const result = await claimChallengeReward({ challengeId, userId }, mockTx); @@ -149,7 +149,7 @@ describe('Challenge Claim Service', () => { expect(result.message).toBe('Challenge not found'); }); - it('should return error when ISA account not found', async () => { + it('ISA 계좌를 찾을 수 없으면 에러를 반환한다', async () => { const mockChallenge = { id: challengeId, etfId, @@ -172,7 +172,7 @@ describe('Challenge Claim Service', () => { expect(result.message).toBe('ISA account not found'); }); - it('should return error when latest ETF price not found', async () => { + it('최신 ETF 가격을 찾을 수 없으면 에러를 반환한다', async () => { const mockChallenge = { id: challengeId, etfId, @@ -196,7 +196,7 @@ describe('Challenge Claim Service', () => { expect(result.message).toBe('Latest ETF price not found'); }); - it('should handle existing ETF holding correctly', async () => { + it('기존 ETF 보유 내역이 있는 경우 올바르게 처리한다', async () => { // Arrange const mockChallenge = { id: challengeId, @@ -276,7 +276,7 @@ describe('Challenge Claim Service', () => { }); }); - it('should correctly calculate avgCost when quantity and price have decimals', async () => { + it('수량과 가격이 소수일 경우 평균 단가를 올바르게 계산한다', async () => { const mockChallenge = { id: challengeId, etfId, diff --git a/__tests__/services/challenge-status.test.ts b/__tests__/services/challenge-status.test.ts index aacd7e9..cc0421e 100644 --- a/__tests__/services/challenge-status.test.ts +++ b/__tests__/services/challenge-status.test.ts @@ -16,7 +16,7 @@ describe('Challenge Status Service', () => { const today = dayjs().tz('Asia/Seoul').startOf('day'); describe('calculateChallengeStatus', () => { - it('should return CLAIMED when challenge is already claimed', () => { + it('이미 보상을 수령한 챌린지는 CLAIMED를 반환한다', () => { const challenge: ChallengeWithProgress = { id: BigInt(1), challengeType: 'ONCE', @@ -30,7 +30,7 @@ describe('Challenge Status Service', () => { expect(status).toBe('CLAIMED'); }); - it('should return ACHIEVABLE for ONCE type when progress >= 1', () => { + it('ONCE 타입 챌린지는 진행도가 1 이상이면 ACHIEVABLE을 반환한다', () => { const challenge: ChallengeWithProgress = { id: BigInt(1), challengeType: 'ONCE', @@ -44,7 +44,7 @@ describe('Challenge Status Service', () => { expect(status).toBe('ACHIEVABLE'); }); - it('should return INCOMPLETE for ONCE type when progress < 1', () => { + it('ONCE 타입 챌린지는 진행도가 1 미만이면 INCOMPLETE를 반환한다', () => { const challenge: ChallengeWithProgress = { id: BigInt(1), challengeType: 'ONCE', @@ -58,7 +58,7 @@ describe('Challenge Status Service', () => { expect(status).toBe('INCOMPLETE'); }); - it('should return ACHIEVABLE for STREAK type when progress >= 7 and updated today', () => { + it('STREAK 타입 챌린지는 진행도 7 이상이고 오늘 갱신됐으면 ACHIEVABLE을 반환한다', () => { const challenge: ChallengeWithProgress = { id: BigInt(1), challengeType: 'STREAK', @@ -76,7 +76,7 @@ describe('Challenge Status Service', () => { expect(status).toBe('ACHIEVABLE'); }); - it('should return INCOMPLETE for STREAK type when progress >= 7 but not updated today', () => { + it('STREAK 타입 챌린지는 진행도 7 이상이어도 오늘 갱신되지 않았으면 INCOMPLETE를 반환한다', () => { const yesterday = today.subtract(1, 'day'); const challenge: ChallengeWithProgress = { id: BigInt(1), @@ -95,7 +95,7 @@ describe('Challenge Status Service', () => { expect(status).toBe('INCOMPLETE'); }); - it('should return ACHIEVABLE for DAILY type when progress > 0 and updated today', () => { + it('DAILY 타입 챌린지는 진행도가 0보다 크고 오늘 갱신됐으면 ACHIEVABLE을 반환한다', () => { const challenge: ChallengeWithProgress = { id: BigInt(1), challengeType: 'DAILY', @@ -113,7 +113,7 @@ describe('Challenge Status Service', () => { expect(status).toBe('ACHIEVABLE'); }); - it('should return ACHIEVABLE for DAILY type when progress > 0 and created today', () => { + it('DAILY 타입 챌린지는 진행도가 0보다 크고 오늘 생성됐으면 ACHIEVABLE을 반환한다', () => { const challenge: ChallengeWithProgress = { id: BigInt(1), challengeType: 'DAILY', @@ -131,7 +131,7 @@ describe('Challenge Status Service', () => { expect(status).toBe('ACHIEVABLE'); }); - it('should return CLAIMED for DAILY type when already claimed today', () => { + it('DAILY 타입 챌린지는 오늘 이미 보상을 수령했으면 CLAIMED를 반환한다', () => { const challenge: ChallengeWithProgress = { id: BigInt(1), challengeType: 'DAILY', @@ -149,7 +149,7 @@ describe('Challenge Status Service', () => { expect(status).toBe('CLAIMED'); }); - it('should return INCOMPLETE for DAILY type when progress = 0 even if updated today', () => { + it('DAILY 타입 챌린지는 진행도가 0이면 오늘 갱신됐더라도 INCOMPLETE를 반환한다', () => { const challenge: ChallengeWithProgress = { id: BigInt(1), challengeType: 'DAILY', @@ -167,7 +167,7 @@ describe('Challenge Status Service', () => { expect(status).toBe('INCOMPLETE'); }); - it('should return INCOMPLETE if no progress data exists', () => { + it('진행도 정보가 없으면 INCOMPLETE를 반환한다', () => { const challenge: ChallengeWithProgress = { id: BigInt(1), challengeType: 'ONCE', @@ -187,7 +187,7 @@ describe('Challenge Status Service', () => { mockTx = createChallengePrismaMock(); }); - it('should return false when challenge not found', async () => { + it('챌린지를 찾을 수 없으면 false를 반환하고 이유를 제공한다', async () => { mockTx.challenge.findUnique.mockResolvedValue(null); const result = await canClaimChallenge(BigInt(1), userId, mockTx); @@ -196,7 +196,7 @@ describe('Challenge Status Service', () => { expect(result.reason).toBe('Challenge not found'); }); - it('should return false when already claimed', async () => { + it('이미 보상을 수령한 챌린지는 false를 반환하고 이유를 제공한다', async () => { const mockChallenge = { id: BigInt(1), challengeType: 'ONCE', @@ -214,7 +214,7 @@ describe('Challenge Status Service', () => { expect(result.reason).toBe('Already claimed'); }); - it('should return true when challenge is achievable', async () => { + it('보상이 가능한 챌린지는 true를 반환한다', async () => { const mockChallenge = { id: BigInt(1), challengeType: 'ONCE', @@ -232,7 +232,7 @@ describe('Challenge Status Service', () => { expect(result.reason).toBeUndefined(); }); - it('should return false when challenge is not completed', async () => { + it('완료되지 않은 챌린지는 false를 반환하고 이유를 제공한다', async () => { const mockChallenge = { id: BigInt(1), challengeType: 'ONCE', diff --git a/tsconfig.json b/tsconfig.json index adf29d9..e07306a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -36,11 +36,5 @@ ".next/types/**/*.ts", "types/next-auth.d.ts" ], - "exclude": [ - "node_modules", - "**/__tests__/**", - "**/__mocks__/**", - "**/*.test.ts", - "**/*.test.tsx" - ] + "exclude": ["node_modules"] }