Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf3bdb04

Browse files
committed
Added unstar() method
1 parent1fd209d commitf3bdb04

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

‎README.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,12 @@ Star a repository.
250250
repo.star(owner, repository,function(err) {});
251251
```
252252

253+
Unstar a repository.
254+
255+
```js
256+
repo.unstar(owner, repository,function(err) {});
257+
```
258+
253259
##User API
254260

255261

‎src/github.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,13 @@
859859
this.star=function(owner,repository,cb){
860860
_request('PUT','/user/starred/'+owner+'/'+repository,null,cb)
861861
};
862+
863+
// Unstar a repository.
864+
// --------
865+
866+
this.unstar=function(owner,repository,cb){
867+
_request('DELETE','/user/starred/'+owner+'/'+repository,null,cb)
868+
};
862869
};
863870

864871
// Gists API

‎test/test.repo.js‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ if (typeof window === 'undefined') { // We're in NodeJS
3737
}
3838
}
3939

40-
describe.only('Github.Repository',function(){
40+
describe('Github.Repository',function(){
4141
before(function(){
4242
github=newGithub({
4343
username:testUser.USERNAME,
@@ -222,7 +222,7 @@ describe.only('Github.Repository', function() {
222222

223223
varrepoTest=Math.floor(Math.random()*100000);
224224

225-
describe('Creating new Github.Repository',function(){
225+
describe.only('Creating new Github.Repository',function(){
226226
before(function(){
227227
github=newGithub({
228228
username:testUser.USERNAME,
@@ -516,6 +516,17 @@ describe('Creating new Github.Repository', function() {
516516
});
517517
});
518518
});
519+
520+
it('should unstar the repo',function(done){
521+
repo.unstar(testUser.USERNAME,repoTest,function(err){
522+
should.not.exist(err);
523+
524+
repo.isStarred(testUser.USERNAME,repoTest,function(err){
525+
err.error.should.equal(404);
526+
done();
527+
});
528+
});
529+
});
519530
});
520531

521532
describe('deleting a Github.Repository',function(){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp