MCPcopy Create free account
hub / github.com/ashfawk/oceanhazard-detection / testMapData

Function testMapData

test-map-fix.js:2–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1// Test script to verify map data is working
2const testMapData = async () => {
3 try {
4 console.log("🧪 Testing Map Data Fix...")
5
6 // Test live data API
7 console.log("\n1. Testing Live Data API...")
8 const response = await fetch("http://localhost:3000/api/social/live-data?limit=10&confidence=0.5")
9 const data = await response.json()
10
11 console.log("✅ Live Data API Response:")
12 console.log("- Success:", data.success)
13 console.log("- Data Count:", data.data?.length || 0)
14 console.log("- Source:", data.source)
15
16 if (data.data && data.data.length > 0) {
17 console.log("\n📍 Sample Reports:")
18 data.data.slice(0, 3).forEach((report, index) => {
19 console.log(`\nReport ${index + 1}:`)
20 console.log("- ID:", report.id)
21 console.log("- Title:", report.title)
22 console.log("- Type:", report.type)
23 console.log("- Severity:", report.severity)
24 console.log("- Location:", report.location)
25 console.log("- Geo-fencing:", report.geoFencing)
26 })
27 }
28
29 // Test social extraction API
30 console.log("\n2. Testing Social Extraction API...")
31 const extractResponse = await fetch("http://localhost:3000/api/social/extract", {
32 method: "POST",
33 headers: { "Content-Type": "application/json" },
34 body: JSON.stringify({
35 keywords: ["tsunami", "cyclone", "flooding"],
36 platforms: ["all"]
37 })
38 })
39
40 const extractData = await extractResponse.json()
41 console.log("✅ Social Extraction Response:")
42 console.log("- Success:", extractData.success)
43 console.log("- Posts Count:", extractData.extracted_posts?.length || 0)
44
45 console.log("\n🎉 Map data test completed!")
46 console.log("\n📱 Open http://localhost:3000/map to see the map with markers!")
47
48 } catch (error) {
49 console.error("❌ Test failed:", error.message)
50 }
51}
52
53// Run the test
54testMapData()

Callers 1

test-map-fix.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected