dimanche 7 octobre 2018

Resolve Dynamo update inside a lambda function

I'm trying to test functionality in my lambda, some of this functionality makes calls to DynamoDB to update. I need this to resolve so that my test does not fail. I am using aws-sdk-mock. I will include my call to Dynamo and my test.

//DB call
database.update(parameters).promise();

//test
it('respond with something', async () => {
    const response = await helper.handler(variable, async () => {
        AWS.mock('DynamoDB', 'update', Promise.resolve());
    });

    assert.equal(something, something);
});

I have tried different variations but this is just an example.

Aucun commentaire:

Enregistrer un commentaire