-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also add support for promises in test library
- Loading branch information
Showing
4 changed files
with
75 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
define(['jquery', 'lodash'], function($) { | ||
var Github = function() { | ||
var rootURL = 'https://api.github.com'; | ||
var organizationName = 'The-Brains'; | ||
|
||
this.getRepos = function() { | ||
return $.getJSON(`${rootURL}/orgs/The-Brains/repos`); | ||
}; | ||
|
||
this.getReposNames = function() { | ||
return this.getRepos().then(function(data) { | ||
return _.map(data, function(repo) { | ||
return _.replace(repo.full_name, `${organizationName}/`, ''); | ||
}); | ||
}) | ||
} | ||
}; | ||
|
||
return Github; | ||
}); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
define( | ||
['chai', './test-wrapper.js', '../githubAPI/githubConnector.js'], | ||
function(chai, testWrapper, GithubConnector) { | ||
var expect = chai.expect; | ||
var mainName = 'githubAPI-githubConnector'; | ||
|
||
testWrapper.execTest(mainName, 'should return correct GET values', function() { | ||
var github = new GithubConnector(); | ||
return github.getReposNames() | ||
.then(function(data) { | ||
expect(data).to.include('Ideas'); | ||
expect(data).to.include('ChaosGame'); | ||
expect(data).to.include('Wolfensheep'); | ||
expect(data).to.include('the-brains.github.io'); | ||
expect(data).to.include('database-storage'); | ||
expect(data).to.include('GithubDB'); | ||
expect(data).to.include('TestSuite'); | ||
return Promise.resolve(); | ||
}); | ||
}); | ||
} | ||
); |
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