import axios from 'axios'; const API_URL = process.env.TEST_API_URL || 'http://localhost:3200/api/geocoding/search'; const API_KEY = process.env.TEST_API_KEY || 'zP9vL5mK2nQ8xR7jT4wS1yB6hG3fV0cX'; const testQueries = [ "سيتي مول", "مستشفى التخصصي" ]; async function testPoiGates() { console.log(`\n🏢 Testing POI Gates (Clustering Integration)\n`); for (const q of testQueries) { try { const searchRes = await axios.get(API_URL, { headers: { 'x-api-key': API_KEY }, params: { q, country: 'jordan' } }); console.log(`🔍 Search for "${q}" -> ${searchRes.data.results?.length} results`); if (searchRes.data.results?.length > 0) { const topResult = searchRes.data.results[0]; console.log(` 🏆 Top Result: ${topResult.name}`); console.log(` Coordinates: ${topResult.latitude}, ${topResult.longitude} (Centroid)`); if (topResult.gates && topResult.gates.length > 0) { console.log(` ✅ Found ${topResult.gates.length} Gates!`); topResult.gates.forEach((gate: any, idx: number) => { const mainMarker = gate.is_main_gate ? '⭐ MAIN GATE' : '🚪 SIDE GATE'; console.log(` ${idx + 1}. [${mainMarker}] ${gate.name_ar} (${gate.name_en})`); console.log(` -> Navigate to: ${gate.latitude}, ${gate.longitude}`); }); } else { console.log(` ⚠️ No gates found. Sero drops will default to centroid.`); } } console.log('--------------------------------------------------'); } catch (e: any) { console.log(`❌ Query "${q}" failed:`, e.response?.data || e.message); } } } testPoiGates().catch(console.error);