const db = require('./config/database');

console.log('Testing healthCheck...');
const timeout = setTimeout(() => {
  console.log('TIMEOUT - healthCheck() is hanging!');
  console.log('Pool stats:', {
    total: db.pool.totalCount,
    idle: db.pool.idleCount,
    waiting: db.pool.waitingCount
  });
  process.exit(1);
}, 5000);

db.healthCheck()
  .then(result => {
    clearTimeout(timeout);
    console.log('SUCCESS:', JSON.stringify(result, null, 2));
    process.exit(0);
  })
  .catch(e => {
    clearTimeout(timeout);
    console.log('ERROR:', e.message);
    process.exit(1);
  });
