Open-Meteo 지오코더가 "현풍"을 경주의 무명 지명으로 풀어 70km 떨어진 예보가 나갔다. 달성군 4개 읍을 KR_CITY_COORDS에 추가하고, openmeteo→kma 교정의 국내 판정을 지점표 밖 지명도 지오코더(대한민국)로 확인하도록 비동기로 확장했다. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
43 lines
2.4 KiB
TypeScript
43 lines
2.4 KiB
TypeScript
/**
|
|
* 국내 위치의 weather_openmeteo → weather_kma 교정(2026-10-14, weather-args.ts)
|
|
*/
|
|
import { describe, test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { redirectOpenMeteoToKmaForKorea as r } from '../src/gateway/chat/weather-args';
|
|
|
|
const both = new Set(['weather_kma', 'weather_openmeteo']);
|
|
|
|
describe('redirectOpenMeteoToKmaForKorea', () => {
|
|
test('국내 지명은 kma forecast로 바뀐다', async () => {
|
|
const out = await r('weather_openmeteo', { hours: 168, location: '구미' }, both, '다음주 구미 날씨');
|
|
assert.equal(out.toolName, 'weather_kma');
|
|
assert.deepEqual(out.args, { location: '구미', type: 'forecast' });
|
|
});
|
|
test('현풍 같은 읍 단위 지명도 kma로 바뀐다', async () => {
|
|
const out = await r('weather_openmeteo', { location: '현풍' }, both, '이번주 현풍 날씨');
|
|
assert.equal(out.toolName, 'weather_kma');
|
|
assert.deepEqual(out.args, { location: '현풍', type: 'forecast' });
|
|
});
|
|
test('해외 도시는 그대로', async () => {
|
|
const out = await r('weather_openmeteo', { location: 'Tokyo' }, both, '도쿄 날씨');
|
|
assert.equal(out.toolName, 'weather_openmeteo');
|
|
});
|
|
test('자외선·시간별 요구는 그대로', async () => {
|
|
assert.equal((await r('weather_openmeteo', { location: '구미' }, both, '구미 자외선 지수')).toolName, 'weather_openmeteo');
|
|
assert.equal((await r('weather_openmeteo', { location: '구미' }, both, '구미 시간별 날씨')).toolName, 'weather_openmeteo');
|
|
});
|
|
test('variables를 직접 지정하면 그대로', async () => {
|
|
assert.equal((await r('weather_openmeteo', { location: '구미', variables: 'uv_index' }, both, '구미 날씨')).toolName, 'weather_openmeteo');
|
|
});
|
|
test('kma가 이번 턴에 없으면 그대로', async () => {
|
|
assert.equal((await r('weather_openmeteo', { location: '구미' }, new Set(['weather_openmeteo']), '구미 날씨')).toolName, 'weather_openmeteo');
|
|
});
|
|
test('여러 도시·좌표는 그대로', async () => {
|
|
assert.equal((await r('weather_openmeteo', { location: '구미, 대구' }, both, '날씨')).toolName, 'weather_openmeteo');
|
|
assert.equal((await r('weather_openmeteo', { location: '36.1,128.3' }, both, '날씨')).toolName, 'weather_openmeteo');
|
|
});
|
|
test('다른 도구는 건드리지 않는다', async () => {
|
|
assert.equal((await r('weather_kma', { location: '구미' }, both, '날씨')).toolName, 'weather_kma');
|
|
});
|
|
});
|