Edit: Be a little more accurate.
I want to test usecases to extend the Github API shell created by our team. For testing, we donβt want to use the extension of the API shell directly, therefore we want to limit its functions. All calls to the API shell should be skipped for tests, and not just for creating a stub.
I have a github module in Node.js:
module.exports = function(args, done) { ... }
And I demand it like this:
var github = require('../services/github');
Now I would like to github(...) using Sinon.js:
var stub_github = sinon.stub(???, "github", function (args, callback) { console.log("the github(...) call was stubbed out!!"); });
But sinon.stub(...) expects me to pass an object and method and does not allow me to drown out the module, which is a function.
Any ideas?
mitchkman
source share