Created
January 13, 2014 10:06
-
-
Save rujmah/8397574 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request') | |
, sinon = require('sinon') | |
, getProfile = require('./gh'); | |
describe('User Profile', function(){ | |
before(function(done){ | |
sinon | |
.stub(request, 'get') | |
.yields(null, null, JSON.stringify({login: "bulkan"})); | |
done(); | |
}); | |
after(function(done){ | |
request.get.restore(); | |
done(); | |
}); | |
it('can get user profile', function(done){ | |
getProfile('bulkan', function(err, result){ | |
if(err) return done(err); | |
request.get.called.should.be.equal(true); | |
result.should.not.be.empty; | |
done(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment