Skip to content

Instantly share code, notes, and snippets.

@NickHeiner
Last active August 29, 2015 14:18
Show Gist options
  • Save NickHeiner/5009b311f725227fc433 to your computer and use it in GitHub Desktop.
Save NickHeiner/5009b311f725227fc433 to your computer and use it in GitHub Desktop.
// Make a bunch of stub objects like this,
// commingling mock behavior with test assertions.
const npm = {
config: {
get: function(prop) {
expect(prop).to.equal('registry');
if (prop === 'registry') {
return npmRegistry;
}
}
}
},
_ = require('lodash'),
q = require('q'),
packageExists = proxyquire('../../../lib/core/package-exists', {
// Mock out everything this module needs. Here's one example:
'../utils/get-npm': _.constant(q(npm))
// So much cruft, even for something so simple!
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment