Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit caa3d86

Browse files
committed
refactor(user): rename methods to improve internal consistency
1 parent ce55779 commit caa3d86

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

lib/User.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class User extends Requestable {
5959
* @param {Requestable.callback} [cb] - will receive the list of repositories
6060
* @return {Promise} - the promise for the http request
6161
*/
62-
getRepos(options, cb) {
62+
listRepos(options, cb) {
6363
if (typeof options === 'function') {
6464
cb = options;
6565
options = {};
@@ -77,7 +77,7 @@ class User extends Requestable {
7777
* @param {Requestable.callback} [cb] - will receive the list of organizations
7878
* @return {Promise} - the promise for the http request
7979
*/
80-
getOrgs(cb) {
80+
listOrgs(cb) {
8181
return this._request('GET', this.__getScopedUrl('orgs'), null, cb);
8282
}
8383

@@ -87,7 +87,7 @@ class User extends Requestable {
8787
* @param {Requestable.callback} [cb] - will receive the list of gists
8888
* @return {Promise} - the promise for the http request
8989
*/
90-
getGists(cb) {
90+
listGists(cb) {
9191
return this._request('GET', this.__getScopedUrl('gists'), null, cb);
9292
}
9393

@@ -98,7 +98,7 @@ class User extends Requestable {
9898
* @param {Requestable.callback} [cb] - will receive the list of repositories
9999
* @return {Promise} - the promise for the http request
100100
*/
101-
getNotifications(options, cb) {
101+
listNotifications(options, cb) {
102102
options = options || {};
103103
if (typeof options === 'function') {
104104
cb = options;
@@ -127,7 +127,7 @@ class User extends Requestable {
127127
* @param {Requestable.callback} [cb] - will receive the list of starred repositories
128128
* @return {Promise} - the promise for the http request
129129
*/
130-
getStarredRepos(cb) {
130+
listStarredRepos(cb) {
131131
let requestOptions = this._getOptionsWithDefaults();
132132
return this._requestAllPages(this.__getScopedUrl('starred'), requestOptions, cb);
133133
}

test/auth.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('Github', function() {
2525
});
2626

2727
it('should authenticate and return no errors', function(done) {
28-
user.getNotifications(assertSuccessful(done));
28+
user.listNotifications(assertSuccessful(done));
2929
});
3030
});
3131

@@ -82,7 +82,7 @@ describe('Github', function() {
8282
});
8383

8484
it('should fail authentication and return err', function(done) {
85-
user.getNotifications(assertFailure(done, function(err) {
85+
user.listNotifications(assertFailure(done, function(err) {
8686
expect(err.status).to.be.equal(401, 'Return 401 status for bad auth');
8787
expect(err.response.data.message).to.equal('Bad credentials');
8888

test/user.spec.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('User', function() {
1616
});
1717

1818
it('should get user repos', function(done) {
19-
user.getRepos(assertArray(done));
19+
user.listRepos(assertArray(done));
2020
});
2121

2222
it('should get user repos with options', function(done) {
@@ -27,19 +27,19 @@ describe('User', function() {
2727
page: 10
2828
};
2929

30-
user.getRepos(filterOpts, assertArray(done));
30+
user.listRepos(filterOpts, assertArray(done));
3131
});
3232

3333
it('should get user orgs', function(done) {
34-
user.getOrgs(assertArray(done));
34+
user.listOrgs(assertArray(done));
3535
});
3636

3737
it('should get user gists', function(done) {
38-
user.getGists(assertArray(done));
38+
user.listGists(assertArray(done));
3939
});
4040

4141
it('should get user notifications', function(done) {
42-
user.getNotifications(assertArray(done));
42+
user.listNotifications(assertArray(done));
4343
});
4444

4545
it('should get user notifications with options', function(done) {
@@ -50,15 +50,15 @@ describe('User', function() {
5050
before: '2015-02-01T00:00:00Z'
5151
};
5252

53-
user.getNotifications(filterOpts, assertArray(done));
53+
user.listNotifications(filterOpts, assertArray(done));
5454
});
5555

5656
it('should get the user\'s profile', function(done) {
5757
user.getProfile(assertSuccessful(done));
5858
});
5959

6060
it('should show user\'s starred repos', function(done) {
61-
user.getStarredRepos(assertArray(done));
61+
user.listStarredRepos(assertArray(done));
6262
});
6363

6464
it('should follow user', function(done) {

0 commit comments

Comments
 (0)