53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Test eBay API Integration
|
|
*
|
|
* Simple script to test eBay API functionality
|
|
*/
|
|
|
|
import { ebayClient } from "./lib/ebay-api.js"
|
|
|
|
async function testEbayApi() {
|
|
console.log("Testing eBay API Integration...")
|
|
console.log("==============================")
|
|
|
|
try {
|
|
// Test basic search functionality
|
|
console.log("\n1. Testing basic search...")
|
|
const results = await ebayClient.searchItems({
|
|
keywords: "vending machine parts",
|
|
maxResults: 2,
|
|
})
|
|
|
|
if (results.length > 0) {
|
|
console.log(`✓ Found ${results.length} items`)
|
|
results.forEach((item, index) => {
|
|
console.log(`\nItem ${index + 1}:`)
|
|
console.log(` Title: ${item.title}`)
|
|
console.log(` Price: ${item.price}`)
|
|
console.log(` Affiliate Link: ${item.affiliateLink}`)
|
|
})
|
|
} else {
|
|
console.log("⚠ No items found (this is expected in sandbox environment)")
|
|
}
|
|
|
|
// Test vending parts search
|
|
console.log("\n2. Testing vending parts search...")
|
|
const partsResults = await ebayClient.searchVendingParts("test-part-123")
|
|
|
|
if (partsResults.length > 0) {
|
|
console.log(`✓ Found ${partsResults.length} parts`)
|
|
} else {
|
|
console.log("⚠ No parts found (this is expected in sandbox environment)")
|
|
}
|
|
|
|
console.log("\n✓ eBay API integration test completed successfully!")
|
|
} catch (error) {
|
|
console.error("✗ eBay API test failed:", error.message)
|
|
process.exit(1)
|
|
}
|
|
}
|
|
|
|
// Run the test
|
|
testEbayApi()
|