lundi 29 juin 2015

See where function is defined

How can I see where this function: http://ift.tt/1HspGOd

copyObject(params = {}, callback) ⇒ AWS.Request

is defined?

What I tried:

var AWS = require('aws-sdk');
AWS.S3.prototype.copyObject
=> undefined

But that is undefined

I want to know it because I want to stub this function with proxyquire:

 var aws_stub = {};
 var Mover =  proxyquire('../../callback/mover',
                         {'aws-sdk': aws_stub}
                         ).Mover;

 var fake_aws_copyObject = function(params, func){func(null, "succeed")};
     fake_aws_copyObject_stub = sinon.spy(fake_aws_copyObject);
     aws_stub.AWS.S3 ... ??   = fake_aws_copyObject_stub; 




Aucun commentaire:

Enregistrer un commentaire