unit test for dynamodb query is a function 1

unit test for dynamodb query is a function

...

function query() {
        return dynamo.query(this.params, function(err, data){            
            if(err){            
                return err.stack;            
            }else{
                console.log("Query Succeeded");            
                return data.item;
            }
        }).Promise();
...

Here is what the above code is Doing:
1. It’s creating a new DynamoDB object, and passing in the AWS credentials.
2. It’s creating a new DynamoDB table object, and passing in the table name.
3. It’s creating a new DynamoDB query object, and passing in the query parameters.
4. It’s calling the query method on the query object, and passing in a callback function.
5. It’s returning the result of the query.

Similar Posts