Skip to content

Commit d81d53f

Browse files
author
Ilya Radchenko
committed
Merge pull request #52 from saraf/nocktest
Testing: getting repos - mocking GitHub with nock
2 parents 8fffbbc + 72b76d0 commit d81d53f

File tree

4 files changed

+390
-6
lines changed

4 files changed

+390
-6
lines changed

lib/api.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ function getRepos(token, username, callback) {
420420
_.each(results, function (result) {
421421
var team_id = result.req.path.split('/');
422422
debug("We get the following repo path: " + util.inspect(result.req.path));
423-
team_id = team_id[2];
423+
team_id = team_id[2]; //TODO: add Enterprise support. This might be different for Github Enterprise
424424

425425
var team_detail = team_detail_requests[parseInt(team_id, 10)];
426426
if (result.statusCode === 204) {
@@ -458,7 +458,8 @@ function getRepos(token, username, callback) {
458458
}
459459
});
460460

461-
// Sometimes we can get multiple copies of the same repo, so we uniq it
461+
//If the user is a member of a team, we get a repository in repos
462+
//as well as team_repos. Thus we need to merge the two and de-dupe
462463
repos = _.uniq(repos.concat(team_repos), false, function (item) {
463464
return item.id;
464465
});

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@
3535
"inline_icon": "github"
3636
},
3737
"devDependencies": {
38-
"jshint": "~2.1.11",
3938
"expect.js": "~0.2.0",
40-
"mocha": "~1.13.0"
39+
"jshint": "~2.1.11",
40+
"mocha": "~1.13.0",
41+
"nock": "^2.10.0"
4142
},
4243
"dependencies": {
4344
"async": "~0.2.9",

0 commit comments

Comments
 (0)