const {query} = require('./config/database');

console.log('Testing query wrapper...');
const timeout = setTimeout(() => {
  console.log('TIMEOUT - query() is hanging!');
  process.exit(1);
}, 3000);

query('SELECT NOW() as time')
  .then(r => {
    clearTimeout(timeout);
    console.log('SUCCESS:', r.rows[0]);
    process.exit(0);
  })
  .catch(e => {
    clearTimeout(timeout);
    console.log('ERROR:', e.message);
    process.exit(1);
  });
