The only way to make it work that I found was this: instead of having:
var MultiPartUpload = require('knox-mpu');
In the instance code. I changed it to:
MultiPartUpload = require('know-mpu');
Then in the test-case I simply put:
MultiPartUpload = sinon.spy();
instance(obj, function () {
expect(MultiPartUpload).to.have.been.called;
done();
});
Any way to do it better than this? (I don't like global vars). Thanks :)