import {expect, it} from 'vitest'; import {condition} from './use-live-weather'; const WEATHER_CODE_LABELS: Record = { 0: '맑음', 1: '대체로 맑음', 2: '구름 조금', 3: '흐림', 45: '안개', 48: '착빙성 안개', 51: '가벼운 이슬비', 53: '보통 이슬비', 55: '강한 이슬비', 56: '가벼운 착빙성 이슬비', 57: '강한 착빙성 이슬비', 61: '약한 비', 63: '보통 비', 65: '강한 비', 66: '약한 착빙성 비', 67: '강한 착빙성 비', 71: '약한 눈', 73: '보통 눈', 75: '강한 눈', 77: '싸라기눈', 80: '약한 소나기', 81: '보통 소나기', 82: '강한 소나기', 85: '약한 소나기눈', 86: '강한 소나기눈', 95: '뇌우', 96: '약한 우박 뇌우', 99: '강한 우박 뇌우', }; it('gives every WMO weather code its own label', () => { for (const [code, label] of Object.entries(WEATHER_CODE_LABELS)) { expect(condition(Number(code))).toBe(label); } }); it('falls back to overcast for unknown codes', () => { expect(condition(4)).toBe('흐림'); expect(condition(-1)).toBe('흐림'); });