index.js
function stubMethod(service, method, replacement) {
  if (!isStubbed(service)) stubService(service);
  if (!replacement) return sinon.stub(getService(service).prototype, method);

  return sinon.stub(getService(service).prototype, method).callsFake(function(params, callback) {
    var _this = { request: stubRequest(), response: stubResponse() };
    replacement.call(_this, params, callback);
    return _this.request;
  });
}
function stubMethod(service, method, replacement) {
  if (!isStubbed(service)) stubService(service);
  if (!replacement) return sinon.stub(getService(service).prototype, method);

  return sinon.stub(getService(service).prototype, method).callsFake(function(params, callback) {
    var _this = { request: stubRequest(), response: stubResponse() };
    replacement.call(_this, params, callback);
    return _this.request;
  });
}
function stubMethod ( service , method , replacement ) { if ( ! isStubbed ( service ) ) stubService ( service ) ; if ( ! replacement ) return sinon . stub ( getService ( service ) . prototype , method ) ; return sinon . stub ( getService ( service ) . prototype , method ) . callsFake ( function ( params , callback ) { var _this = { request : stubRequest ( ) , response : stubResponse ( ) } ; replacement . call ( _this , params , callback ) ; return _this . request ; } ) ; }
Replaces a single AWS service method with a stub.

@param {string} service - the name of the AWS service. Can include `.` for
nested services, e.g. `'DynamoDB.DocumentClient'`.
@param {string} method - the name of the service method to stub.
@param {function} [replacement] - if specified, this function will be called
when the service method stub is invoked. `this` in the context of the function
will provide a reference to stubbed AWS.Request and AWS.Response objects to
simulate more advanced aws-sdk-js usage patterns.
@returns {object} stub - [a sinon stub](http://sinonjs.org/docs/#stubs).
Replaces a single AWS service method with a stub .