Skip to content

Instantly share code, notes, and snippets.

@kenperkins
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kenperkins/df11d0856e6319d478ca to your computer and use it in GitHub Desktop.
Save kenperkins/df11d0856e6319d478ca to your computer and use it in GitHub Desktop.
Mocking methods in pkgcloud
var EventEmitter2 = require('eventemitter2').EventEmitter2;
var client = {
upload: function(options, callback) {
var stream = new EventEmitter2({
wildcard: false,
delimiter: '::',
newListener: false,
maxListeners: 20
});
return stream;
callback();
// emit the end event after returning the stream to the caller
setTimeout(function() {
stream.emit('end');
}, 15);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment