javascript - How to test async await pg connection with jest? -


i trying test function makes connection pg, using async await,

import pg 'pg';    module.exports.test = async(event, context, callback) => {      const client = new pg.client(someconnectionstring);    try {      await client.connect();    } catch (e) {      return callback(e);    }    try {      await client.query(await someasyncfunction(test));      client.end();      return callback(null, 'success');    } catch (e) {      client.end();      return callback(e);    }

don't understand how mock using jest? ideas?


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -