Files
homeclaw/tests/weather-openmeteo-korea.test.ts

17 lines
740 B
TypeScript

import { test } from 'node:test';
import assert from 'node:assert/strict';
import { isKoreanLatLon, weatherOpenMeteoTool } from '../src/tools/weather';
test('국내 좌표 판정', () => {
assert.equal(isKoreanLatLon(36.12, 128.34), true); // 구미
assert.equal(isKoreanLatLon(33.5, 126.5), true); // 제주
assert.equal(isKoreanLatLon(35.68, 139.69), false); // 도쿄
assert.equal(isKoreanLatLon(40.71, -74.0), false); // 뉴욕
});
test('국내 좌표는 장기(days>10)가 아니면 거부, 도구 설명에 weather_kma 안내', async () => {
const r = await weatherOpenMeteoTool.execute({ location: '36.12,128.34', days: 3 });
assert.equal(r.success, false);
assert.match(String(r.error), /weather_kma/);
});