title: Mocking using aws-sdk-mock's promise support with DocumentClient
body: <p>I'm trying to write a unit test using aws-sdk-mock's promise support. I'm using DocumentClient.</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>const docClient = new AWS.DynamoDB.DocumentClient();
  
  const getItemPromise = docClient.get(params).promise();
     return getItemPromise.then((data) =&gt; {
     console.log('Success');
     return data;
  }).catch((err) =&gt; {
     console.log(err);
  });
  </code></pre>
  
  <p>My mock and unit test looks like this:</p>
  
  <pre><code>const AWS = require('aws-sdk-mock');
  AWS.Promise = Promise.Promise;
  
  AWS.mock('DynamoDB.DocumentClient', 'get', function (params, callback)
  {
     callback(null, { Item: { Key: 'test value } });
  });
  
  dynamoStore.getItems('tableName', 'idName', 'id').then((actualResponse) =&gt; {
    // assertions
    done();
  });
  </code></pre>
  
  <p>Runnning my unit test, does not return my test value, it actually bypasses my mock, and calls calls dynamoDb directly. What am I doing wrong? How can I get my mock set up properly?</p>