I have a lambda for which I'd like to write unit tests for. I'm using async await but I'm getting issues with resolve promises. I'd like to test the different conditions, how can I write the test to resolve and stop seeing the timeouts?
Thanks in advance.
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
--- unit
describe('tests', function() {
describe('describe an error', () => {
it('should return a 500', (done) => {
handler('', {}, (err, response) => {
expect(err.status).to.eq('failed')
done()
})
})
})
});
-- handler
export const handler = async (event, context, callback) => {
return callback(null, status: 500 )
})