- package.json: vitest 추가 + test/test:watch 스크립트 - utils/__tests__/formatting.test.js (7 tests) - features/symbol/__tests__/utils.test.js (8 tests) - features/liberation/__tests__/utils.test.js (18 tests) - features/boss-crystal/pc/admin/__tests__/constants.test.js (6 tests) 총 39개 테스트 통과 (716ms) - formatMeso / formatMesoKorean 경계 조건 - computeCompletion (심볼 완료 시뮬레이션) - bossEarn, calcWeekPoints, calcDoneEarn, calcMonthlyEarn - getSchedulerWeekRange (1주차/2주차, 목요일 시작 등) - computeCompletionDate (단순 계산/주차별 계산 모드) - 보스 결정 난이도 정의 및 스타일 헬퍼 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
import { describe, it, expect } from 'vitest'
|
|
import { formatMeso, formatMesoKorean } from '../formatting'
|
|
|
|
describe('formatMeso', () => {
|
|
it('0 이하는 "0" 반환', () => {
|
|
expect(formatMeso(0)).toBe('0')
|
|
expect(formatMeso(-100)).toBe('0')
|
|
expect(formatMeso(null)).toBe('0')
|
|
expect(formatMeso(undefined)).toBe('0')
|
|
})
|
|
|
|
it('1만 미만은 그대로 locale 표기', () => {
|
|
expect(formatMeso(500)).toBe('500')
|
|
expect(formatMeso(9999)).toBe('9,999')
|
|
})
|
|
|
|
it('만 단위만', () => {
|
|
expect(formatMeso(10000)).toBe('1만')
|
|
expect(formatMeso(12345)).toBe('1만')
|
|
expect(formatMeso(99_990_000)).toBe('9,999만')
|
|
})
|
|
|
|
it('억 단위만', () => {
|
|
expect(formatMeso(100_000_000)).toBe('1억')
|
|
expect(formatMeso(500_000_000)).toBe('5억')
|
|
})
|
|
|
|
it('억 + 만 조합', () => {
|
|
expect(formatMeso(100_010_000)).toBe('1억 1만')
|
|
expect(formatMeso(123_456_789)).toBe('1억 2,345만')
|
|
expect(formatMeso(2_576_000_000)).toBe('25억 7,600만')
|
|
})
|
|
|
|
it('formatMesoKorean은 formatMeso와 동일', () => {
|
|
expect(formatMesoKorean(100_010_000)).toBe(formatMeso(100_010_000))
|
|
expect(formatMesoKorean(0)).toBe('0')
|
|
})
|
|
|
|
it('문자열 입력도 처리', () => {
|
|
expect(formatMeso('12345')).toBe('1만')
|
|
expect(formatMeso('100000000')).toBe('1억')
|
|
})
|
|
})
|