// TODO: 매직 넘버들을 의미 있는 상수로 추출하세요. // 동작은 그대로 유지해야 합니다 (테스트 통과). export function calculateDiscount(price: number, quantity: number) { if (quantity >= 100) { return price * 0.8; } else if (quantity >= 50) { return price * 0.9; } else if (quantity >= 10) { return price * 0.95; } return price; } export function validatePassword(password: string): boolean { return password.length >= 8 && password.length <= 128; } export function Pagination({ total }: { total: number }) { const pages = Math.ceil(total / 20); return ( <div data-testid="pagination" style={{ marginTop: 16, padding: 24 }}> {Array.from({ length: pages }, (_, i) => ( <button key={i}>{i + 1}</button> ))} </div> ); }
Tests