const fetch = require('node-fetch');
const https = require('https');
// Disable SSL verification for local testing
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';
const serverUrl = 'https://localhost:3003';
async function testBankLeumiWithQuery() {
console.log('\n🚀 Testing Bank Leumi Recommendations with userQuery\n');
console.log('=' .repeat(70));
// First, we need to authenticate using OAuth flow
// We'll use the bearer token from the V2 test that just ran
// For a real test, you'd need to do the full OAuth flow
console.log('📊 Test: Bank Leumi BL Test Env with userQuery');
console.log('-'.repeat(70));
// This test requires a valid OAuth bearer token
// You need to run the OAuth flow first (localhost-oauth-test-recommendations-v2.js)
console.log('\nℹ️ This test requires OAuth authentication.');
console.log(' Please ensure you have a valid bearer token from the OAuth flow.\n');
// Example of what the request should look like with userQuery
const testRequest = {
jsonrpc: '2.0',
method: 'tools/call',
params: {
name: 'get_all_recommendations',
arguments: {
userQuery: 'show me recommendations for Bank Leumi BL Test Env',
daysBack: 30,
pageSize: 100,
includeClosedAndDone: false
}
},
id: 1
};
console.log('📤 Example request with userQuery:');
console.log(JSON.stringify(testRequest, null, 2));
console.log('\n✅ Expected behavior:');
console.log(' 1. Server detects "Bank Leumi BL Test Env" in userQuery');
console.log(' 2. Server looks up customer with key 24223 (BL Test Env)');
console.log(' 3. API key should be: 57ade50e-c9a8-49f3-8ce7-28d44536a669:24223:1');
console.log(' 4. Request should succeed with Bank Leumi recommendations\n');
console.log('🔍 To verify, check server logs for:');
console.log(' [GET_ALL_RECOMMENDATIONS] MSP customer - detecting from query');
console.log(' [GET_ALL_RECOMMENDATIONS] ✅ Detected customer: Bank Leumi BL Test Env');
console.log(' [API-CLIENT] Using MSP API key with customer account');
}
testBankLeumiWithQuery();