Files
cannaiq/backend/scripts/test-jane-discovery-az.ts
Kelly d7da0b938d feat(jane): Direct Algolia product fetch and multi-platform product-refresh
- Add fetchProductsByStoreIdDirect() for reliable Algolia product fetching
- Update product-discovery-jane to use direct Algolia instead of network interception
- Fix product-refresh handler to support both Dutchie and Jane payloads
  - Handle both `products` (Dutchie) and `hits` (Jane) formats
  - Use platform-appropriate raw_json structure for normalizers
  - Fix consecutive_misses tracking to use correct provider
  - Extract product IDs correctly (Dutchie _id vs Jane product_id)
- Add store discovery deduplication (prefer REC over MED at same location)
- Add storeTypes field to DiscoveredStore interface
- Add scripts: run-jane-store-discovery.ts, run-jane-product-discovery.ts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 16:05:50 -07:00

51 lines
1.4 KiB
TypeScript

/**
* Smoke test: Discover Jane stores in Arizona
* Usage: npx ts-node scripts/test-jane-discovery-az.ts
*/
import { discoverStoresByState } from '../src/platforms/jane';
async function main() {
console.log('='.repeat(60));
console.log('Jane Store Discovery - Arizona Smoke Test');
console.log('='.repeat(60));
console.log('Using local IP (no proxy)\n');
try {
const stores = await discoverStoresByState('AZ');
console.log(`\n${'='.repeat(60)}`);
console.log(`RESULTS: Found ${stores.length} Jane stores in Arizona`);
console.log('='.repeat(60));
if (stores.length > 0) {
console.log('\nSample stores:');
for (const store of stores.slice(0, 10)) {
console.log(` - ${store.name}`);
console.log(` ID: ${store.storeId} | ${store.city}, AZ`);
console.log(` Types: ${store.storeTypes?.join(', ') || 'unknown'}`);
console.log(` Products: ${store.productCount || 'N/A'}`);
console.log('');
}
if (stores.length > 10) {
console.log(` ... and ${stores.length - 10} more stores`);
}
}
console.log('\n' + '='.repeat(60));
console.log('SMOKE TEST PASSED');
console.log('='.repeat(60));
} catch (error: any) {
console.error('\n' + '='.repeat(60));
console.error('SMOKE TEST FAILED');
console.error('='.repeat(60));
console.error(`Error: ${error.message}`);
console.error(error.stack);
process.exit(1);
}
}
main();