const pool = require('./db');

async function testConnection() {
  const connection = await pool.getConnection();
  await connection.ping();
  const [rows] = await connection.query('SELECT DATABASE() AS db');
  connection.release();
  return rows[0].db;
}

module.exports = testConnection;
