From dd8100b67c0aa2b449595804aa8cea54d4fa6c6d Mon Sep 17 00:00:00 2001 From: Mr Simon FodubuCommunity Date: Tue, 16 Dec 2025 21:43:15 -0800 Subject: [PATCH] Add Pi Network integration testing script This script tests the integration with the Pi Network by checking the API health, generating an auth URL, verifying Stellar SDK availability, and listing installed Pi-related packages. --- scripts/test-pi-integration.js | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 scripts/test-pi-integration.js diff --git a/scripts/test-pi-integration.js b/scripts/test-pi-integration.js new file mode 100644 index 0000000..26e2b44 --- /dev/null +++ b/scripts/test-pi-integration.js @@ -0,0 +1,48 @@ +import PiIntegration from '../src/utils/piIntegration.js'; + +async function testPiIntegration() { + console.log('🧪 Testing Pi Network Integration...\n'); + + try { + // 1. Test health check + console.log('1️⃣ Testing Pi API Health...'); + const health = await PiIntegration.healthCheck(); + console.log(` Status: ${health.status}`); + console.log(` Pi API: ${health.piApi}`); + + // 2. Test auth URL generation + console.log('\n2️⃣ Testing Auth URL Generation...'); + const authUrl = PiIntegration.generateAuthUrl( + 'FODUBU', + 'https://trade.fodubu.com/auth/pi/callback' + ); + console.log(` Auth URL: ${authUrl.substring(0, 80)}...`); + + // 3. Test Stellar SDK availability + console.log('\n3️⃣ Testing Stellar SDK...'); + try { + const StellarSdk = await import('@stellar/backend'); + console.log(' ✅ Stellar SDK loaded successfully'); + console.log(` Version: ${StellarSdk.version}`); + } catch (error) { + console.log(' ❌ Stellar SDK error:', error.message); + } + + // 4. List installed Pi-related packages + console.log('\n4️⃣ Installed Pi & Stellar Packages:'); + const packages = [ + '@stellar/stellar-backend', + '@fod-team/pi-nodejs' + ]; + + for (const pkg of packages) { + try { + await import(pkg); + console.log(` ✅ ${pkg} - Available`); + } catch { + console.log(` ❌ ${pkg} - Not available`); + } + } + +// Run test +testPiIntegration();