DEV Community

Discussion on: Unit Testing AWS Lambda Functions in Node.js

 
jarroo profile image
Alex Manarpies

I double-checked by setting a breakpoint and it's not being triggered. Notice that the deps property is actually a function:

exports.deps = () => { // notice the closure syntax
  const AWS = require('aws-sdk')
  const documentClient = new AWS.DynamoDB.DocumentClient()

  return Promise.resolve({
    dynamoBatchWrite: params => documentClient.batchWrite(params).promise()
  })
}

.. its body contents should only be run when deps is invoked as a function (in this case async).

Thread Thread
 
harkinj profile image
harkinj

Perfect, thanks for your time and this great article.