Comparing version 0.2.10 to 0.2.11
@@ -25,3 +25,11 @@ #!/usr/bin/env node | ||
var main = module.exports = function(routes, tests) { | ||
var main = module.exports = function() { | ||
// check routes path | ||
var routesPath = Path.join(__dirname, "routes.json"); | ||
var routes = JSON.parse(fs.readFileSync(routesPath, "utf8")); | ||
if (!routes.defines) { | ||
Util.log("No routes defined.", "fatal"); | ||
process.exit(1); | ||
} | ||
Util.log("Generating..."); | ||
@@ -160,10 +168,5 @@ | ||
Object.keys(sections).forEach(function(section) { | ||
// When we don't need to generate tests, bail out here. | ||
if (!tests) | ||
return; | ||
Util.log("Writing test file for " + section); | ||
var def = testSections[section]; | ||
// test if previous tests already contained implementations by checking | ||
// if the difference in character count between the current test file | ||
// and the newly generated one is more than twenty characters. | ||
var body = TestSectionTpl | ||
@@ -174,10 +177,3 @@ .replace("<%version%>", "3.0.0") | ||
var path = Path.join(__dirname, "test", section + "Test.js"); | ||
if (fs.existsSync(path) && Math.abs(fs.readFileSync(path, "utf8").length - body.length) >= 20) { | ||
Util.log("Moving old test file to '" + path + ".bak' to preserve tests " + | ||
"that were already implemented. \nPlease be sure te check this file " + | ||
"and move all implemented tests back into the newly generated test!", "error"); | ||
fs.renameSync(path, path + ".bak"); | ||
} | ||
Util.log("Writing test file for " + section); | ||
fs.writeFileSync(path, body, "utf8"); | ||
@@ -187,28 +183,2 @@ }); | ||
if (!module.parent) { | ||
var argv = Optimist | ||
.wrap(80) | ||
.usage("Generate the implementation of the node-github module, including " | ||
+ "unit-test scaffolds.\nUsage: $0 [-r] [-v VERSION]") | ||
.alias("t", "tests") | ||
.describe("t", "Also generate unit test scaffolds") | ||
.alias("h", "help") | ||
.describe("h", "Display this usage information") | ||
.boolean(["t", "h"]) | ||
.argv; | ||
if (argv.help) { | ||
Util.log(Optimist.help()); | ||
process.exit(); | ||
} | ||
var routesPath = Path.join(__dirname, "routes.json"); | ||
var routes = JSON.parse(fs.readFileSync(routesPath, "utf8")); | ||
if (!routes.defines) { | ||
Util.log("No routes defined.", "fatal"); | ||
process.exit(1); | ||
} | ||
Util.log("Starting up..."); | ||
main(routes, argv.tests); | ||
} | ||
main(); |
@@ -172,2 +172,3 @@ "use strict"; | ||
var Client = module.exports = function(config) { | ||
config = config || {} | ||
config.headers = config.headers || {}; | ||
@@ -174,0 +175,0 @@ this.config = config; |
{ | ||
"name": "github4", | ||
"version": "0.2.10", | ||
"version": "0.2.11", | ||
"description": "NodeJS wrapper for the GitHub API", | ||
@@ -31,4 +31,3 @@ "author": "Mike de Boer <info@mikedeboer.nl>", | ||
"https-proxy-agent": "^1.0.0", | ||
"mime": "^1.2.11", | ||
"oauth": "^0.9.14" | ||
"mime": "^1.2.11" | ||
}, | ||
@@ -35,0 +34,0 @@ "devDependencies": { |
@@ -121,2 +121,8 @@ ##### NOTE: [mikedeboer/node-github](https://github.com/mikedeboer/node-github) seems to no longer be maintained so I forked it here and am working on applying PRs and issues from that repo. See progress [here](https://github.com/kaizensoze/github4/wiki/Transition-from-upstream). | ||
## Generate/update docs/tests | ||
```bash | ||
$ node generate.js | ||
``` | ||
## Tests | ||
@@ -123,0 +129,0 @@ |
@@ -13,3 +13,3 @@ /* | ||
var Assert = require("assert"); | ||
var Client = require("./../index"); | ||
var Client = require("./../../index"); | ||
@@ -20,10 +20,7 @@ describe("[authorization]", function() { | ||
this.timeout(10000); | ||
beforeEach(function() { | ||
client = new Client(); | ||
client.authenticate({ | ||
type: "basic", | ||
username: "mikedeboertest", | ||
password: "test1324" | ||
type: "oauth", | ||
token: token | ||
}); | ||
@@ -33,44 +30,11 @@ }); | ||
it("should successfully execute GET /authorizations (getAll)", function(next) { | ||
client.authorization.create( | ||
client.authorization.getAll( | ||
{ | ||
scopes: ["user", "public_repo", "repo", "repo:status", "delete_repo", "gist"], | ||
note: "Authorization created to unit tests auth", | ||
note_url: "https://github.com/ajaxorg/node-github" | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.authorization.getAll( | ||
{ | ||
page: "1", | ||
per_page: "100" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.length, 1); | ||
client.authorization["delete"]( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
client.authorization.getAll( | ||
{ | ||
page: "1", | ||
per_page: "100" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.length, 0); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -81,42 +45,10 @@ ); | ||
it("should successfully execute GET /authorizations/:id (get)", function(next) { | ||
client.authorization.create( | ||
client.authorization.get( | ||
{ | ||
scopes: ["user", "public_repo", "repo", "repo:status", "delete_repo", "gist"], | ||
note: "Authorization created to unit tests auth", | ||
note_url: "https://github.com/ajaxorg/node-github" | ||
id: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.authorization.get( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.id, id); | ||
Assert.equal(res.note, "Authorization created to unit tests auth"); | ||
Assert.equal(res.note_url, "https://github.com/ajaxorg/node-github"); | ||
client.authorization["delete"]( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
client.authorization.get( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err.code, 404); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -129,40 +61,10 @@ ); | ||
{ | ||
scopes: ["user", "public_repo", "repo", "repo:status", "delete_repo", "gist"], | ||
note: "Authorization created to unit tests auth", | ||
note_url: "https://github.com/ajaxorg/node-github" | ||
scopes: "Array", | ||
note: "String", | ||
note_url: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.authorization.get( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.id, id); | ||
Assert.equal(res.note, "Authorization created to unit tests auth"); | ||
Assert.equal(res.note_url, "https://github.com/ajaxorg/node-github"); | ||
client.authorization["delete"]( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
client.authorization.get( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err.code, 404); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -173,54 +75,15 @@ ); | ||
it("should successfully execute PATCH /authorizations/:id (update)", function(next) { | ||
client.authorization.create( | ||
client.authorization.update( | ||
{ | ||
scopes: ["user", "public_repo", "repo", "repo:status", "delete_repo", "gist"], | ||
note: "Authorization created to unit tests auth", | ||
note_url: "https://github.com/ajaxorg/node-github" | ||
id: "String", | ||
scopes: "Array", | ||
add_scopes: "Array", | ||
remove_scopes: "Array", | ||
note: "String", | ||
note_url: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.authorization.update( | ||
{ | ||
id: id, | ||
remove_scopes: ["repo"], | ||
note: "changed" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
client.authorization.get( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.id, id); | ||
Assert.ok(res.scopes.indexOf("repo") === -1); | ||
Assert.equal(res.note, "changed"); | ||
Assert.equal(res.note_url, "https://github.com/ajaxorg/node-github"); | ||
client.authorization["delete"]( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
client.authorization.get( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err.code, 404); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -231,30 +94,10 @@ ); | ||
it("should successfully execute DELETE /authorizations/:id (delete)", function(next) { | ||
client.authorization.create( | ||
client.authorization.delete( | ||
{ | ||
scopes: ["user", "public_repo", "repo", "repo:status", "delete_repo", "gist"], | ||
note: "Authorization created to unit tests auth", | ||
note_url: "https://github.com/ajaxorg/node-github" | ||
id: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.authorization["delete"]( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
client.authorization.get( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err.code, 404); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -261,0 +104,0 @@ ); |
@@ -13,3 +13,3 @@ /* | ||
var Assert = require("assert"); | ||
var Client = require("./../index"); | ||
var Client = require("./../../index"); | ||
@@ -31,15 +31,8 @@ describe("[events]", function() { | ||
{ | ||
page: 1, | ||
per_page: 30 | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
Assert.equal(err, null); | ||
Assert.ok(res.length > 1); | ||
Assert.equal(typeof res[0].type, "string"); | ||
Assert.equal(typeof res[0].created_at, "string"); | ||
Assert.equal(typeof res[0]["public"], "boolean"); | ||
Assert.equal(typeof res[0].id, "string"); | ||
Assert.ok("actor" in res[0]); | ||
Assert.ok("repo" in res[0]); | ||
next(); | ||
@@ -53,16 +46,10 @@ } | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat" | ||
user: "String", | ||
repo: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.length, 5); | ||
// this is the lastly listed event | ||
var last = res.pop(); | ||
Assert.equal(last.type, "ForkEvent"); | ||
Assert.equal(last.created_at, "2012-10-05T15:03:11Z"); | ||
Assert.equal(last.id, "1607304921"); | ||
Assert.equal(last["public"], true); | ||
Assert.equal(last.actor.login, "mikedeboer"); | ||
Assert.equal(last.repo.name, "mikedeboertest/node_chat"); | ||
// other assertions go here | ||
next(); | ||
@@ -76,17 +63,10 @@ } | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat" | ||
user: "String", | ||
repo: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.length, 4); | ||
// this is the lastly listed event | ||
var last = res.pop(); | ||
Assert.equal(last.event, "referenced"); | ||
Assert.equal(last.created_at, "2012-10-05T15:05:31Z"); | ||
Assert.equal(last.id, "26276344"); | ||
Assert.equal(last.actor.login, "mikedeboertest"); | ||
Assert.equal(last.issue.title, "Macaroni"); | ||
Assert.equal(last.issue.number, 1); | ||
Assert.equal(last.issue.state, "closed"); | ||
// other assertions go here | ||
next(); | ||
@@ -100,12 +80,10 @@ } | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat" | ||
user: "String", | ||
repo: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.ok(res.length > 1); | ||
var last = res.pop(); | ||
Assert.equal(typeof last.id, "string"); | ||
Assert.equal(typeof last.created_at, "string"); | ||
Assert.equal(typeof last.actor, "object"); | ||
// other assertions go here | ||
next(); | ||
@@ -119,11 +97,9 @@ } | ||
{ | ||
org: "ajaxorg" | ||
org: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.ok(res.length > 1); | ||
var last = res.pop(); | ||
Assert.equal(typeof last.id, "string"); | ||
Assert.equal(typeof last.created_at, "string"); | ||
Assert.equal(typeof last.actor, "object"); | ||
// other assertions go here | ||
next(); | ||
@@ -137,11 +113,9 @@ } | ||
{ | ||
user: "mikedeboertest" | ||
user: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.ok(res.length > 0); | ||
var last = res.pop(); | ||
Assert.equal(typeof last.id, "string"); | ||
Assert.equal(typeof last.created_at, "string"); | ||
Assert.equal(typeof last.actor, "object"); | ||
// other assertions go here | ||
next(); | ||
@@ -155,11 +129,9 @@ } | ||
{ | ||
user: "mikedeboertest" | ||
user: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.ok(res.length > 0); | ||
var last = res.pop(); | ||
Assert.equal(typeof last.id, "string"); | ||
Assert.equal(typeof last.created_at, "string"); | ||
Assert.equal(typeof last.actor, "object"); | ||
// other assertions go here | ||
next(); | ||
@@ -173,11 +145,9 @@ } | ||
{ | ||
user: "mikedeboertest" | ||
user: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.ok(res.length > 1); | ||
var last = res.pop(); | ||
Assert.equal(typeof last.id, "string"); | ||
Assert.equal(typeof last.created_at, "string"); | ||
Assert.equal(typeof last.actor, "object"); | ||
// other assertions go here | ||
next(); | ||
@@ -191,11 +161,9 @@ } | ||
{ | ||
user: "mikedeboertest" | ||
user: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.ok(res.length > 1); | ||
var last = res.pop(); | ||
Assert.equal(typeof last.id, "string"); | ||
Assert.equal(typeof last.created_at, "string"); | ||
Assert.equal(typeof last.actor, "object"); | ||
// other assertions go here | ||
next(); | ||
@@ -209,9 +177,10 @@ } | ||
{ | ||
user: "mikedeboer", | ||
org: "ajaxorg" | ||
user: "String", | ||
org: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
// we're not logged in as `mikedeboer` right now, so github API does not allow | ||
// us to see the resource. | ||
Assert.equal(err.code, 404); | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
@@ -218,0 +187,0 @@ } |
@@ -13,3 +13,3 @@ /* | ||
var Assert = require("assert"); | ||
var Client = require("./../index"); | ||
var Client = require("./../../index"); | ||
@@ -19,3 +19,2 @@ describe("[gists]", function() { | ||
var token = "c286e38330e15246a640c2cf32a45ea45d93b2ba"; | ||
timeout(5000); | ||
@@ -32,13 +31,10 @@ beforeEach(function() { | ||
client.gists.getAll( | ||
{}, | ||
{ | ||
page: "Number", | ||
per_page: "Number", | ||
since: "Date" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.length, 1); | ||
var gist = res.pop(); | ||
Assert.equal(gist.user.login, "mikedeboertest"); | ||
Assert.equal(gist.html_url, "https://gist.github.com/77dc15615eab09a79b61"); | ||
Assert.equal(gist.created_at, "2012-10-05T16:10:40Z"); | ||
Assert.equal(gist.public, false); | ||
Assert.equal(gist.id, "77dc15615eab09a79b61"); | ||
// other assertions go here | ||
next(); | ||
@@ -52,13 +48,10 @@ } | ||
{ | ||
user: "mikedeboertest" | ||
user: "String", | ||
page: "Number", | ||
per_page: "Number", | ||
since: "Date" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.length, 1); | ||
var gist = res.pop(); | ||
Assert.equal(gist.user.login, "mikedeboertest"); | ||
Assert.equal(gist.html_url, "https://gist.github.com/77dc15615eab09a79b61"); | ||
Assert.equal(gist.created_at, "2012-10-05T16:10:40Z"); | ||
Assert.equal(gist.public, false); | ||
Assert.equal(gist.id, "77dc15615eab09a79b61"); | ||
// other assertions go here | ||
next(); | ||
@@ -72,37 +65,10 @@ } | ||
{ | ||
description: "Another bowl of pasta", | ||
public: "false", | ||
files: { | ||
"ravioli.js": { | ||
"content": "alert(\"want some ketchup with that?\");" | ||
} | ||
} | ||
description: "String", | ||
public: "Boolean", | ||
files: "Json" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.gists.get( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.user.login, "mikedeboertest"); | ||
Assert.equal(res.html_url, "https://gist.github.com/" + id); | ||
Assert.equal(res.public, false); | ||
Assert.equal(res.id, id); | ||
Assert.equal(res.description, "Another bowl of pasta"); | ||
client.gists["delete"]( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -113,65 +79,24 @@ ); | ||
it("should successfully execute PATCH /gists/:id (edit)", function(next) { | ||
client.gists.create( | ||
client.gists.edit( | ||
{ | ||
description: "Another bowl of pasta", | ||
public: "false", | ||
files: { | ||
"ravioli.js": { | ||
"content": "alert(\"want some ketchup with that?\");" | ||
} | ||
} | ||
id: "String", | ||
description: "String", | ||
files: "Json" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.gists.edit( | ||
{ | ||
id: id, | ||
description: "changed", | ||
files: { | ||
"ravioli.js": { | ||
"content": "alert(\"no ketchup, please.\");" | ||
} | ||
} | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
client.gists.get( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.user.login, "mikedeboertest"); | ||
Assert.equal(res.html_url, "https://gist.github.com/" + id); | ||
Assert.equal(res.public, false); | ||
Assert.equal(res.id, id); | ||
Assert.equal(res.description, "changed"); | ||
Assert.equal(res.files["ravioli.js"].content, "alert(\"no ketchup, please.\");"); | ||
client.gists["delete"]( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
); | ||
}); | ||
/* | ||
it("should successfully execute GET /gists/public (public)", function(next) { | ||
client.gists.public( | ||
{}, | ||
{ | ||
since: "Date" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
console.log(res); | ||
// other assertions go here | ||
next(); | ||
@@ -181,16 +106,11 @@ } | ||
}); | ||
*/ | ||
it("should successfully execute GET /gists/starred (starred)", function(next) { | ||
client.gists.starred( | ||
{}, | ||
{ | ||
since: "Date" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.length, 1); | ||
var gist = res.pop(); | ||
Assert.equal(gist.user.login, "mikedeboertest"); | ||
Assert.equal(gist.html_url, "https://gist.github.com/77dc15615eab09a79b61"); | ||
Assert.equal(gist.created_at, "2012-10-05T16:10:40Z"); | ||
Assert.equal(gist.public, false); | ||
Assert.equal(gist.id, "77dc15615eab09a79b61"); | ||
// other assertions go here | ||
next(); | ||
@@ -202,39 +122,10 @@ } | ||
it("should successfully execute GET /gists/:id (get)", function(next) { | ||
client.gists.create( | ||
client.gists.get( | ||
{ | ||
description: "Another bowl of pasta", | ||
public: "false", | ||
files: { | ||
"ravioli.js": { | ||
"content": "alert(\"want some ketchup with that?\");" | ||
} | ||
} | ||
id: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.gists.get( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.user.login, "mikedeboertest"); | ||
Assert.equal(res.html_url, "https://gist.github.com/" + id); | ||
Assert.equal(res.public, false); | ||
Assert.equal(res.id, id); | ||
Assert.equal(res.description, "Another bowl of pasta"); | ||
client.gists["delete"]( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -245,44 +136,10 @@ ); | ||
it("should successfully execute PUT /gists/:id/star (star)", function(next) { | ||
client.gists.create( | ||
client.gists.star( | ||
{ | ||
description: "Another bowl of pasta", | ||
public: "false", | ||
files: { | ||
"ravioli.js": { | ||
"content": "alert(\"want some ketchup with that?\");" | ||
} | ||
} | ||
id: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.gists.star( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
client.gists.checkStar( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
//TODO: NO RESULT HERE??? | ||
client.gists["delete"]( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -293,43 +150,10 @@ ); | ||
it("should successfully execute DELETE /gists/:id/star (deleteStar)", function(next) { | ||
client.gists.create( | ||
client.gists.deleteStar( | ||
{ | ||
description: "Another bowl of pasta", | ||
public: "false", | ||
files: { | ||
"ravioli.js": { | ||
"content": "alert(\"want some ketchup with that?\");" | ||
} | ||
} | ||
id: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.gists.star( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
client.gists.deleteStar( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
client.gists["delete"]( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -340,34 +164,10 @@ ); | ||
it("should successfully execute GET /gists/:id/star (checkStar)", function(next) { | ||
client.gists.create( | ||
client.gists.checkStar( | ||
{ | ||
description: "Another bowl of pasta", | ||
public: "false", | ||
files: { | ||
"ravioli.js": { | ||
"content": "alert(\"want some ketchup with that?\");" | ||
} | ||
} | ||
id: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.gists.star( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
client.gists["delete"]( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -380,22 +180,8 @@ ); | ||
{ | ||
id: "3047099" | ||
id: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
Assert.equal(res.git_pull_url, "git://gist.github.com/" + id + ".git"); | ||
Assert.equal(res.git_push_url, "git@gist.github.com:" + id + ".git"); | ||
Assert.equal(res.description, "Why to call resume() after next()"); | ||
Assert.equal(typeof res.files["resume_after_next.md"], "object"); | ||
client.gists["delete"]( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
next(); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -406,25 +192,10 @@ ); | ||
it("should successfully execute DELETE /gists/:id (delete)", function(next) { | ||
client.gists.create( | ||
client.gists.delete( | ||
{ | ||
description: "Another bowl of pasta", | ||
public: "false", | ||
files: { | ||
"ravioli.js": { | ||
"content": "alert(\"want some ketchup with that?\");" | ||
} | ||
} | ||
id: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.gists["delete"]( | ||
{ | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
next(); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -434,35 +205,11 @@ ); | ||
it("should successfully execute GET /gists/:gist_id/comments/:id (getComments)", function(next) { | ||
client.gists.createComment( | ||
it("should successfully execute GET /gists/:gist_id/comments (getComments)", function(next) { | ||
client.gists.getComments( | ||
{ | ||
gist_id: "3047099", | ||
body: "This is a test comment.", | ||
gist_id: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.gists.getComments( | ||
{ | ||
gist_id: "3047099" | ||
}, | ||
function(err, res) { | ||
var comment = res.pop(); | ||
Assert.equal(err, null); | ||
Assert.equal(comment.user.login, "mikedeboertest"); | ||
Assert.equal(comment.id, id); | ||
Assert.equal(comment.body, "This is a test comment."); | ||
client.gists["deleteComment"]( | ||
{ | ||
gist_id: "3047099", | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -473,34 +220,11 @@ ); | ||
it("should successfully execute GET /gists/:gist_id/comments/:id (getComment)", function(next) { | ||
client.gists.createComment( | ||
client.gists.getComment( | ||
{ | ||
gist_id: "3047099", | ||
body: "This is a test comment.", | ||
gist_id: "String", | ||
id: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.gists.getComment( | ||
{ | ||
gist_id: "3047099", | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.user.login, "mikedeboertest"); | ||
Assert.equal(res.id, id); | ||
Assert.equal(res.body, "This is a test comment."); | ||
client.gists["deleteComment"]( | ||
{ | ||
gist_id: "3047099", | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -513,32 +237,9 @@ ); | ||
{ | ||
gist_id: "3047099", | ||
body: "This is a test comment.", | ||
gist_id: "String", | ||
body: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.gists.getComment( | ||
{ | ||
gist_id: "3047099", | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.user.login, "mikedeboertest"); | ||
Assert.equal(res.id, id); | ||
Assert.equal(res.body, "This is a test comment."); | ||
client.gists["deleteComment"]( | ||
{ | ||
gist_id: "3047099", | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -549,45 +250,12 @@ ); | ||
it("should successfully execute PATCH /gists/:gist_id/comments/:id (editComment)", function(next) { | ||
client.gists.createComment( | ||
client.gists.editComment( | ||
{ | ||
gist_id: "3047099", | ||
body: "This is a test comment.", | ||
gist_id: "String", | ||
id: "String", | ||
body: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.gists.editComment( | ||
{ | ||
gist_id: "3047099", | ||
id: id, | ||
body: "This comment has been edited." | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.gists.getComment( | ||
{ | ||
gist_id: "3047099", | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.user.login, "mikedeboertest"); | ||
Assert.equal(res.id, id); | ||
Assert.equal(res.body, "This comment has been edited."); | ||
client.gists["deleteComment"]( | ||
{ | ||
gist_id: "3047099", | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -598,21 +266,11 @@ ); | ||
it("should successfully execute DELETE /gists/:gist_id/comments/:id (deleteComment)", function(next) { | ||
client.gists.createComment( | ||
client.gists.deleteComment( | ||
{ | ||
gist_id: "3047099", | ||
body: "This is a test comment.", | ||
gist_id: "String", | ||
id: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var id = res.id; | ||
client.gists["deleteComment"]( | ||
{ | ||
gist_id: "3047099", | ||
id: id | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
next(); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -619,0 +277,0 @@ ); |
@@ -13,3 +13,3 @@ /* | ||
var Assert = require("assert"); | ||
var Client = require("./../index"); | ||
var Client = require("./../../index"); | ||
@@ -29,16 +29,13 @@ describe("[gitdata]", function() { | ||
it("should successfully execute GET /repos/:user/:repo/git/blobs/:sha (getBlob)", function(next) { | ||
// found an object after executing: | ||
// git rev-list --all | xargs -l1 git diff-tree -r -c -M -C --no-commit-id | awk '{print $3}' | ||
client.gitdata.getBlob( | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
sha: "8433b682c95edf3fd81f5ee217dc9c874db35e4b" | ||
user: "String", | ||
repo: "String", | ||
sha: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.sha, "8433b682c95edf3fd81f5ee217dc9c874db35e4b"); | ||
Assert.equal(res.size, 2654); | ||
Assert.equal(res.encoding, "base64"); | ||
// other assertions go here | ||
next(); | ||
@@ -52,27 +49,11 @@ } | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
content: "test", | ||
encoding: "utf-8" | ||
user: "String", | ||
repo: "String", | ||
content: "String", | ||
encoding: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(typeof res.sha, "string"); | ||
var sha = res.sha; | ||
client.gitdata.getBlob( | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
sha: sha | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.sha, sha); | ||
Assert.equal(res.size, 4); | ||
Assert.equal(res.encoding, "base64"); | ||
next(); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -85,12 +66,9 @@ ); | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
sha: "17e0734295ffd8174f91f04ba8e8f8e51954b793" | ||
user: "String", | ||
repo: "String", | ||
sha: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.author.date, "2012-10-05T08:05:31-07:00"); | ||
Assert.equal(res.author.name, "Mike de Boer"); | ||
Assert.equal(res.parents[0].sha, "221140b288a3c64949594c58420cb4ab289b0756"); | ||
Assert.equal(res.parents[1].sha, "d2836429f4ff7de033c8bc0d16d22d55f2ea39c3"); | ||
// other assertions go here | ||
next(); | ||
@@ -102,29 +80,15 @@ } | ||
it("should successfully execute POST /repos/:user/:repo/git/commits (createCommit)", function(next) { | ||
// got valid tree reference by executing | ||
// git cat-file -p HEAD | ||
client.gitdata.createCommit( | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
message: "test", | ||
tree: "8ce4393a319b60bc6179509e0c46dee83c179f9f", | ||
parents: [], | ||
author: { | ||
name: "test-chef", | ||
email: "test-chef@pasta-nirvana.it", | ||
date: "2008-07-09T16:13:30+12:00" | ||
}, | ||
committer: { | ||
name: "test-minion", | ||
email: "test-minion@pasta-nirvana.it", | ||
date: "2008-07-09T16:13:30+12:00" | ||
} | ||
user: "String", | ||
repo: "String", | ||
message: "String", | ||
tree: "String", | ||
parents: "Array", | ||
author: "Json", | ||
committer: "Json" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.author.name, "test-chef"); | ||
Assert.equal(res.author.email, "test-chef@pasta-nirvana.it"); | ||
Assert.equal(res.committer.name, "test-minion"); | ||
Assert.equal(res.committer.email, "test-minion@pasta-nirvana.it"); | ||
Assert.equal(res.message, "test"); | ||
// other assertions go here | ||
next(); | ||
@@ -138,11 +102,9 @@ } | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
ref: "heads/master" | ||
user: "String", | ||
repo: "String", | ||
ref: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.ref, "refs/heads/master"); | ||
Assert.equal(res.object.type, "commit"); | ||
Assert.equal(res.object.sha, "17e0734295ffd8174f91f04ba8e8f8e51954b793"); | ||
// other assertions go here | ||
next(); | ||
@@ -156,11 +118,10 @@ } | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat" | ||
user: "String", | ||
repo: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var ref = res[0]; | ||
Assert.equal(ref.ref, "refs/heads/master"); | ||
Assert.equal(ref.object.type, "commit"); | ||
Assert.equal(ref.object.sha, "17e0734295ffd8174f91f04ba8e8f8e51954b793"); | ||
// other assertions go here | ||
next(); | ||
@@ -170,4 +131,2 @@ } | ||
}); | ||
/* | ||
DISABLED temporarily due to Internal Server Error from Github! | ||
@@ -177,161 +136,58 @@ it("should successfully execute POST /repos/:user/:repo/git/refs (createReference)", function(next) { | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
ref: "heads/tagliatelle", | ||
sha: "17e0734295ffd8174f91f04ba8e8f8e51954b793" | ||
user: "String", | ||
repo: "String", | ||
ref: "String", | ||
sha: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
console.log(res); | ||
// other assertions go here | ||
client.gitdata.deleteReference( | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
ref: "heads/tagliatelle" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
} | ||
); | ||
next(); | ||
} | ||
); | ||
});*/ | ||
}); | ||
it("should successfully execute PATCH /repos/:user/:repo/git/refs/:ref (updateReference)", function(next) { | ||
client.gitdata.getReference( | ||
client.gitdata.updateReference( | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
ref: "heads/master" | ||
user: "String", | ||
repo: "String", | ||
ref: "String", | ||
sha: "String", | ||
force: "Boolean" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var sha = res.object.sha; | ||
// do `force=true` because we go backward in history, which yields a warning | ||
// that it's not a reference that can be fast-forwarded to. | ||
client.gitdata.updateReference( | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
ref: "heads/master", | ||
sha: "221140b288a3c64949594c58420cb4ab289b0756", | ||
force: true | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.ref, "refs/heads/master"); | ||
Assert.equal(res.object.type, "commit"); | ||
Assert.equal(res.object.sha, "221140b288a3c64949594c58420cb4ab289b0756"); | ||
client.gitdata.updateReference( | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
ref: "heads/master", | ||
sha: sha, | ||
force: false | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.ref, "refs/heads/master"); | ||
Assert.equal(res.object.type, "commit"); | ||
Assert.equal(res.object.sha, sha); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
); | ||
}); | ||
/* | ||
DISABLED temporarily due to Internal Server Error from Github! | ||
it("should successfully execute DELETE /repos/:user/:repo/git/refs/:ref (deleteReference)", function(next) { | ||
client.gitdata.createReference( | ||
client.gitdata.deleteReference( | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
ref: "heads/tagliatelle", | ||
sha: "17e0734295ffd8174f91f04ba8e8f8e51954b793" | ||
user: "String", | ||
repo: "String", | ||
ref: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
console.log(res); | ||
// other assertions go here | ||
client.gitdata.deleteReference( | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
ref: "heads/tagliatelle" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
} | ||
); | ||
next(); | ||
} | ||
); | ||
});*/ | ||
}); | ||
it("should successfully execute GET /repos/:user/:repo/git/tags/:sha (getTag)", function(next) { | ||
client.gitdata.createTag( | ||
client.gitdata.getTag( | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
tag: "test-pasta", | ||
message: "Grandma's secret sauce", | ||
object: "17e0734295ffd8174f91f04ba8e8f8e51954b793", | ||
type: "commit", | ||
tagger: { | ||
name: "test-chef", | ||
email: "test-chef@pasta-nirvana.it", | ||
date: "2008-07-09T16:13:30+12:00" | ||
} | ||
user: "String", | ||
repo: "String", | ||
sha: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var sha = res.sha; | ||
client.gitdata.getTag( | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
sha: sha | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.tag, "test-pasta"); | ||
Assert.equal(res.message, "Grandma's secret sauce"); | ||
Assert.equal(res.sha, sha); | ||
Assert.equal(res.tagger.name, "test-chef"); | ||
Assert.equal(res.tagger.email, "test-chef@pasta-nirvana.it"); | ||
// other assertions go here | ||
client.gitdata.deleteReference( | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
ref: "tags/" + sha | ||
}, | ||
function(err, res) { | ||
//Assert.equal(err, null); | ||
// NOTE: Github return 'Validation Failed' error codes back, which makes no sense to me. | ||
// ask the guys what's up here... | ||
Assert.equal(err.code, 422); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -344,50 +200,14 @@ ); | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
tag: "test-pasta", | ||
message: "Grandma's secret sauce", | ||
object: "17e0734295ffd8174f91f04ba8e8f8e51954b793", | ||
type: "commit", | ||
tagger: { | ||
name: "test-chef", | ||
email: "test-chef@pasta-nirvana.it", | ||
date: "2008-07-09T16:13:30+12:00" | ||
} | ||
user: "String", | ||
repo: "String", | ||
tag: "String", | ||
message: "String", | ||
object: "String", | ||
type: "String", | ||
tagger: "Json" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var sha = res.sha; | ||
client.gitdata.getTag( | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
sha: sha | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.tag, "test-pasta"); | ||
Assert.equal(res.message, "Grandma's secret sauce"); | ||
Assert.equal(res.sha, sha); | ||
Assert.equal(res.tagger.name, "test-chef"); | ||
Assert.equal(res.tagger.email, "test-chef@pasta-nirvana.it"); | ||
// other assertions go here | ||
client.gitdata.deleteReference( | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
ref: "tags/" + sha | ||
}, | ||
function(err, res) { | ||
//Assert.equal(err, null); | ||
// NOTE: Github return 'Validation Failed' error codes back, which makes no sense to me. | ||
// ask the guys what's up here... | ||
Assert.equal(err.code, 422); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -400,33 +220,11 @@ ); | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
sha: "8ce4393a319b60bc6179509e0c46dee83c179f9f", | ||
recursive: false | ||
user: "String", | ||
repo: "String", | ||
sha: "String", | ||
recursive: "Boolean" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.tree[0].type, "blob"); | ||
Assert.equal(res.tree[0].path, "LICENSE-MIT"); | ||
Assert.equal(res.tree[0].sha, "f30a31de94635399f42fd05f91f6ed3ff2f013d6"); | ||
Assert.equal(res.tree[0].mode, "100644"); | ||
Assert.equal(res.tree[0].size, 1075); | ||
client.gitdata.getTree( | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
sha: "8ce4393a319b60bc6179509e0c46dee83c179f9f", | ||
recursive: true | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.tree[0].type, "blob"); | ||
Assert.equal(res.tree[0].path, "LICENSE-MIT"); | ||
Assert.equal(res.tree[0].sha, "f30a31de94635399f42fd05f91f6ed3ff2f013d6"); | ||
Assert.equal(res.tree[0].mode, "100644"); | ||
Assert.equal(res.tree[0].size, 1075); | ||
next(); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -437,51 +235,13 @@ ); | ||
it("should successfully execute POST /repos/:user/:repo/git/trees (createTree)", function(next) { | ||
client.gitdata.getTree( | ||
client.gitdata.createTree( | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
sha: "8ce4393a319b60bc6179509e0c46dee83c179f9f", | ||
recursive: false | ||
user: "String", | ||
repo: "String", | ||
tree: "Json", | ||
base_tree: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var file = res.tree[0]; | ||
client.gitdata.createTree( | ||
{ | ||
base_tree: "8ce4393a319b60bc6179509e0c46dee83c179f9f", | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
tree: [ | ||
{ | ||
path: file.path, | ||
mode: "100755", | ||
type: file.type, | ||
sha: file.sha | ||
} | ||
] | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
var sha = res.sha; | ||
client.gitdata.getTree( | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
sha: sha, | ||
recursive: true | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.tree[0].type, "blob"); | ||
Assert.equal(res.tree[0].path, "LICENSE-MIT"); | ||
Assert.equal(res.tree[0].sha, "f30a31de94635399f42fd05f91f6ed3ff2f013d6"); | ||
Assert.equal(res.tree[0].mode, "100755"); | ||
Assert.equal(res.tree[0].size, 1075); | ||
next(); | ||
} | ||
); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -488,0 +248,0 @@ ); |
@@ -13,9 +13,14 @@ /* | ||
var Assert = require("assert"); | ||
var Client = require("./../index"); | ||
var Client = require("./../../index"); | ||
describe("[gitignore]", function() { | ||
var client; | ||
var token = "c286e38330e15246a640c2cf32a45ea45d93b2ba"; | ||
beforeEach(function() { | ||
client = new Client(); | ||
client.authenticate({ | ||
type: "oauth", | ||
token: token | ||
}); | ||
}); | ||
@@ -29,5 +34,2 @@ | ||
// other assertions go here | ||
Assert.ifError(err); | ||
Assert(Array.isArray(res)); | ||
Assert(res.length > 10); | ||
next(); | ||
@@ -41,3 +43,3 @@ } | ||
{ | ||
name: "C" | ||
name: "String" | ||
}, | ||
@@ -47,6 +49,2 @@ function(err, res) { | ||
// other assertions go here | ||
Assert.ifError(err); | ||
Assert('name' in res); | ||
Assert('source' in res); | ||
Assert(typeof res.source === 'string'); | ||
next(); | ||
@@ -53,0 +51,0 @@ } |
@@ -13,3 +13,3 @@ /* | ||
var Assert = require("assert"); | ||
var Client = require("./../index"); | ||
var Client = require("./../../index"); | ||
@@ -31,18 +31,14 @@ describe("[issues]", function() { | ||
{ | ||
filter: "created", | ||
state: "open", | ||
labels: "", | ||
sort: "updated", | ||
direction: "asc" | ||
filter: "String", | ||
state: "String", | ||
labels: "String", | ||
sort: "String", | ||
direction: "String", | ||
since: "Date", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.length, 1); | ||
var issue = res[0]; | ||
Assert.equal(issue.title, "My First Issue"); | ||
Assert.equal(issue.number, 2); | ||
Assert.equal(issue.state, "open"); | ||
Assert.equal(issue.body, "Willing to start a debate on the best recipe of macaroni."); | ||
Assert.equal(issue.assignee.login, "mikedeboertest"); | ||
// other assertions go here | ||
next(); | ||
@@ -56,18 +52,19 @@ } | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
state: "open", | ||
sort: "updated", | ||
direction: "asc" | ||
user: "String", | ||
repo: "String", | ||
milestone: "String", | ||
state: "String", | ||
assignee: "String", | ||
creator: "String", | ||
mentioned: "String", | ||
labels: "String", | ||
sort: "String", | ||
direction: "String", | ||
since: "Date", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.length, 1); | ||
var issue = res[0]; | ||
Assert.equal(issue.title, "My First Issue"); | ||
Assert.equal(issue.number, 2); | ||
Assert.equal(issue.state, "open"); | ||
Assert.equal(issue.body, "Willing to start a debate on the best recipe of macaroni."); | ||
Assert.equal(issue.assignee.login, "mikedeboertest"); | ||
// other assertions go here | ||
next(); | ||
@@ -81,14 +78,9 @@ } | ||
{ | ||
user: "mikedeboertest", | ||
repo: "node_chat", | ||
number: 2 | ||
user: "String", | ||
repo: "String", | ||
number: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.title, "My First Issue"); | ||
Assert.equal(res.number, 2); | ||
Assert.equal(res.state, "open"); | ||
Assert.equal(res.body, "Willing to start a debate on the best recipe of macaroni."); | ||
Assert.equal(res.assignee.login, "mikedeboertest"); | ||
// other assertions go here | ||
next(); | ||
@@ -98,3 +90,3 @@ } | ||
}); | ||
/* | ||
it("should successfully execute POST /repos/:user/:repo/issues (create)", function(next) { | ||
@@ -129,3 +121,4 @@ client.issues.create( | ||
milestone: "Number", | ||
labels: "Json" | ||
labels: "Json", | ||
state: "String" | ||
}, | ||
@@ -140,2 +133,21 @@ function(err, res) { | ||
it("should successfully execute GET /repos/:user/:repo/issues/comments (repoComments)", function(next) { | ||
client.issues.repoComments( | ||
{ | ||
user: "String", | ||
repo: "String", | ||
sort: "String", | ||
direction: "String", | ||
since: "Date", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
} | ||
); | ||
}); | ||
it("should successfully execute GET /repos/:user/:repo/issues/:number/comments (getComments)", function(next) { | ||
@@ -272,3 +284,5 @@ client.issues.getComments( | ||
user: "String", | ||
repo: "String" | ||
repo: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
@@ -345,2 +359,17 @@ function(err, res) { | ||
it("should successfully execute GET /repos/:user/:repo/issues/:number/labels (getIssueLabels)", function(next) { | ||
client.issues.getIssueLabels( | ||
{ | ||
user: "String", | ||
repo: "String", | ||
number: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
} | ||
); | ||
}); | ||
it("should successfully execute GET /repos/:user/:repo/milestones (getAllMilestones)", function(next) { | ||
@@ -429,3 +458,3 @@ client.issues.getAllMilestones( | ||
); | ||
});*/ | ||
}); | ||
}); |
@@ -13,3 +13,3 @@ /* | ||
var Assert = require("assert"); | ||
var Client = require("./../index"); | ||
var Client = require("./../../index"); | ||
@@ -22,6 +22,6 @@ describe("[markdown]", function() { | ||
client = new Client(); | ||
/*client.authenticate({ | ||
client.authenticate({ | ||
type: "oauth", | ||
token: token | ||
});*/ | ||
}); | ||
}); | ||
@@ -32,9 +32,9 @@ | ||
{ | ||
text: "Hello world github/linguist#1 **cool**, and #1!", | ||
mode: "gfm", | ||
context: "github/gollem" | ||
text: "String", | ||
mode: "String", | ||
context: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
console.log(res); | ||
// other assertions go here | ||
next(); | ||
@@ -45,10 +45,10 @@ } | ||
it("should successfully execute POST /markdown/raw (render)", function(next) { | ||
it("should successfully execute POST /markdown/raw (renderRaw)", function(next) { | ||
client.markdown.renderRaw( | ||
{ | ||
data: "Hello world github/linguist#1 **cool**, and #1!" | ||
data: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
console.log(res); | ||
// other assertions go here | ||
next(); | ||
@@ -55,0 +55,0 @@ } |
@@ -13,9 +13,14 @@ /* | ||
var Assert = require("assert"); | ||
var Client = require("./../index"); | ||
var Client = require("./../../index"); | ||
describe("[misc]", function() { | ||
var client; | ||
var token = "c286e38330e15246a640c2cf32a45ea45d93b2ba"; | ||
beforeEach(function() { | ||
client = new Client(); | ||
client.authenticate({ | ||
type: "oauth", | ||
token: token | ||
}); | ||
}); | ||
@@ -29,5 +34,2 @@ | ||
// other assertions go here | ||
Assert.ifError(err); | ||
// A common emoji on github | ||
Assert('shipit' in res); | ||
next(); | ||
@@ -44,4 +46,2 @@ } | ||
// other assertions go here | ||
Assert('hooks' in res); | ||
Assert('git' in res); | ||
next(); | ||
@@ -57,11 +57,3 @@ } | ||
Assert.equal(err, null); | ||
Assert('resources' in res); | ||
Assert('core' in res.resources); | ||
Assert(typeof res.resources.core.limit === 'number'); | ||
Assert(typeof res.resources.core.remaining === 'number'); | ||
Assert(typeof res.resources.core.reset === 'number'); | ||
Assert('search' in res.resources); | ||
Assert(typeof res.resources.search.limit === 'number'); | ||
Assert(typeof res.resources.search.remaining === 'number'); | ||
Assert(typeof res.resources.search.reset === 'number'); | ||
// other assertions go here | ||
next(); | ||
@@ -68,0 +60,0 @@ } |
@@ -13,3 +13,3 @@ /* | ||
var Assert = require("assert"); | ||
var Client = require("./../index"); | ||
var Client = require("./../../index"); | ||
@@ -81,3 +81,4 @@ describe("[orgs]", function() { | ||
page: "Number", | ||
per_page: "Number" | ||
per_page: "Number", | ||
filter: "String" | ||
}, | ||
@@ -147,2 +148,30 @@ function(err, res) { | ||
it("should successfully execute PUT /orgs/:org/memberships/:user (addOrganizationMembership)", function(next) { | ||
client.orgs.addOrganizationMembership( | ||
{ | ||
org: "String", | ||
user: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
} | ||
); | ||
}); | ||
it("should successfully execute DELETE /orgs/:org/memberships/:user (removeOrganizationMembership)", function(next) { | ||
client.orgs.removeOrganizationMembership( | ||
{ | ||
org: "String", | ||
user: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
} | ||
); | ||
}); | ||
it("should successfully execute PUT /orgs/:org/public_members/:user (publicizeMembership)", function(next) { | ||
@@ -179,3 +208,5 @@ client.orgs.publicizeMembership( | ||
{ | ||
org: "String" | ||
org: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
@@ -304,2 +335,30 @@ function(err, res) { | ||
it("should successfully execute PUT /teams/:id/memberships/:user (addTeamMembership)", function(next) { | ||
client.orgs.addTeamMembership( | ||
{ | ||
id: "String", | ||
user: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
} | ||
); | ||
}); | ||
it("should successfully execute GET /teams/:id/memberships/:user (getTeamMembership)", function(next) { | ||
client.orgs.getTeamMembership( | ||
{ | ||
id: "String", | ||
user: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
} | ||
); | ||
}); | ||
it("should successfully execute GET /teams/:id/repos (getTeamRepos)", function(next) { | ||
@@ -306,0 +365,0 @@ client.orgs.getTeamRepos( |
@@ -13,3 +13,3 @@ /* | ||
var Assert = require("assert"); | ||
var Client = require("./../index"); | ||
var Client = require("./../../index"); | ||
@@ -33,7 +33,9 @@ describe("[pullRequests]", function() { | ||
repo: "String", | ||
state: "String", | ||
head: "String", | ||
base: "String", | ||
head: "String", | ||
state: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
per_page: "Number", | ||
sort: "String", | ||
direction: "String" | ||
}, | ||
@@ -40,0 +42,0 @@ function(err, res) { |
@@ -1,2 +0,2 @@ | ||
/* | ||
/* | ||
* Copyright 2012 Cloud9 IDE, Inc. | ||
@@ -13,5 +13,3 @@ * | ||
var Assert = require("assert"); | ||
var Client = require("./../index"); | ||
var fs = require("fs"); | ||
var mime = require("mime"); | ||
var Client = require("./../../index"); | ||
@@ -22,14 +20,2 @@ describe("[releases]", function() { | ||
var owner = "greggman"; | ||
var repo = "test"; | ||
var haveWriteAccess = true; // set to false if the authenticated person below does not have write access to the repo above | ||
var releaseIdWithAsset = 393621; // Some release id from the repo above that has at least 1 asset. | ||
var filePathToUpload = __filename; | ||
var fileSizeToUpload = fs.statSync(filePathToUpload).size; | ||
var releaseId; // release id found when listing releases. Used for get release | ||
var newReleaseId; // release id created when creating release, used for edit and delete release | ||
var assetId; // asset id found when listing assets. Used for get asset | ||
var newAssetId; // asset id used when creating asset. Used for edit and delete asset | ||
beforeEach(function() { | ||
@@ -46,11 +32,10 @@ client = new Client(); | ||
{ | ||
owner: owner, | ||
repo: repo, | ||
owner: "String", | ||
repo: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.ok(res instanceof Array); | ||
if (res instanceof Array && res.length > 0) { | ||
releaseId = res[0].id; | ||
} | ||
// other assertions go here | ||
next(); | ||
@@ -62,15 +47,11 @@ } | ||
it("should successfully execute GET /repos/:owner/:repo/releases/:id (getRelease)", function(next) { | ||
if (!releaseId) { | ||
next(); | ||
return; | ||
} | ||
client.releases.getRelease( | ||
{ | ||
owner: owner, | ||
id: releaseId, | ||
repo: repo | ||
owner: "String", | ||
id: "Number", | ||
repo: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.id, releaseId); | ||
// other assertions go here | ||
next(); | ||
@@ -84,7 +65,8 @@ } | ||
{ | ||
owner: owner, | ||
repo: repo | ||
owner: "String", | ||
repo: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
@@ -96,27 +78,16 @@ } | ||
it("should successfully execute POST /repos/:owner/:repo/releases (createRelease)", function(next) { | ||
if (!haveWriteAccess) { | ||
next(); | ||
return; | ||
} | ||
client.releases.createRelease( | ||
{ | ||
owner: owner, | ||
repo: repo, | ||
tag_name: "node-github-tag", | ||
target_commitish: "master", | ||
name: "node-github-name", | ||
body: "node-github-body", | ||
draft: false, | ||
prerelease: true, | ||
owner: "String", | ||
repo: "String", | ||
tag_name: "String", | ||
target_commitish: "String", | ||
name: "String", | ||
body: "String", | ||
draft: "Boolean", | ||
prerelease: "Boolean" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.tag_name, "node-github-tag"); | ||
Assert.equal(res.target_commitish, "master"); | ||
Assert.equal(res.name, "node-github-name"); | ||
Assert.equal(res.body, "node-github-body"); | ||
Assert.equal(res.assets.length, 0); | ||
Assert.ok(res.prerelease); | ||
Assert.ok(!res.draft); | ||
newReleaseId = res.id; | ||
// other assertions go here | ||
next(); | ||
@@ -128,28 +99,17 @@ } | ||
it("should successfully execute PATCH /repos/:owner/:repo/releases/:id (editRelease)", function(next) { | ||
if (!haveWriteAccess) { | ||
next(); | ||
return; | ||
} | ||
client.releases.editRelease( | ||
{ | ||
owner: owner, | ||
id: newReleaseId, | ||
repo: repo, | ||
tag_name: "node-github-new-tag", | ||
target_commitish: "master", | ||
name: "node-github-new-name", | ||
body: "node-github-new-body", | ||
draft: true, | ||
prerelease: true, | ||
owner: "String", | ||
id: "Number", | ||
repo: "String", | ||
tag_name: "String", | ||
target_commitish: "String", | ||
name: "String", | ||
body: "String", | ||
draft: "Boolean", | ||
prerelease: "Boolean" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.id, newReleaseId); | ||
Assert.equal(res.tag_name, "node-github-new-tag"); | ||
Assert.equal(res.target_commitish, "master"); | ||
Assert.equal(res.name, "node-github-new-name"); | ||
Assert.equal(res.body, "node-github-new-body"); | ||
Assert.equal(res.assets.length, 0); | ||
Assert.ok(res.prerelease); | ||
Assert.ok(res.draft); | ||
// other assertions go here | ||
next(); | ||
@@ -161,14 +121,11 @@ } | ||
it("should successfully execute DELETE /repos/:owner/:repo/releases/:id (deleteRelease)", function(next) { | ||
if (!haveWriteAccess) { | ||
next(); | ||
return; | ||
} | ||
client.releases.deleteRelease( | ||
{ | ||
owner: owner, | ||
repo: repo, | ||
id: newReleaseId, | ||
owner: "String", | ||
id: "Number", | ||
repo: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
@@ -182,12 +139,9 @@ } | ||
{ | ||
owner: owner, | ||
id: releaseIdWithAsset, | ||
repo: repo | ||
owner: "String", | ||
id: "Number", | ||
repo: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.ok(res instanceof Array); | ||
if (res instanceof Array && res.length > 0) { | ||
assetId = res[0].id; | ||
} | ||
// other assertions go here | ||
next(); | ||
@@ -199,15 +153,11 @@ } | ||
it("should successfully execute GET /repos/:owner/:repo/releases/assets/:id (getAsset)", function(next) { | ||
if (!assetId) { | ||
next(); | ||
return; | ||
} | ||
client.releases.getAsset( | ||
{ | ||
owner: owner, | ||
id: assetId, | ||
repo: repo | ||
owner: "String", | ||
id: "Number", | ||
repo: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.id, assetId); | ||
// other assertions go here | ||
next(); | ||
@@ -219,18 +169,12 @@ } | ||
it("should successfully execute POST /repos/:owner/:repo/releases/:id/assets (uploadAsset)", function(next) { | ||
var name = "somenameornot.zip"; | ||
client.releases.uploadAsset( | ||
{ | ||
owner: owner, | ||
id: releaseIdWithAsset, | ||
repo: repo, | ||
name: name, | ||
filePath: filePathToUpload | ||
owner: "String", | ||
id: "Number", | ||
repo: "String", | ||
name: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.content_type, mime.lookup(name)); // matches extension of name, not filePath | ||
Assert.equal(res.state, "uploaded"); | ||
Assert.equal(res.size, fileSizeToUpload); | ||
Assert.equal(res.name, name); | ||
newAssetId = res.id; | ||
// other assertions go here | ||
next(); | ||
@@ -242,21 +186,13 @@ } | ||
it("should successfully execute PATCH /repos/:owner/:repo/releases/assets/:id (editAsset)", function(next) { | ||
if (!newAssetId) { | ||
next(); | ||
return; | ||
} | ||
var newName = "somenewname.zip"; | ||
client.releases.editAsset( | ||
{ | ||
owner: owner, | ||
id: newAssetId, | ||
repo: repo, | ||
name: newName, | ||
label: "foo" | ||
owner: "String", | ||
id: "Number", | ||
repo: "String", | ||
name: "String", | ||
label: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.state, "uploaded"); | ||
Assert.equal(res.size, fileSizeToUpload); | ||
Assert.equal(res.name, newName); | ||
Assert.equal(res.label, "foo"); | ||
// other assertions go here | ||
next(); | ||
@@ -268,11 +204,7 @@ } | ||
it("should successfully execute DELETE /repos/:owner/:repo/releases/assets/:id (deleteAsset)", function(next) { | ||
if (!newAssetId) { | ||
next(); | ||
return; | ||
} | ||
client.releases.deleteAsset( | ||
{ | ||
owner: owner, | ||
id: newAssetId, | ||
repo: repo | ||
owner: "String", | ||
id: "Number", | ||
repo: "String" | ||
}, | ||
@@ -279,0 +211,0 @@ function(err, res) { |
@@ -13,3 +13,3 @@ /* | ||
var Assert = require("assert"); | ||
var Client = require("./../index"); | ||
var Client = require("./../../index"); | ||
@@ -137,2 +137,15 @@ describe("[repos]", function() { | ||
it("should successfully execute GET /repositories/:id (one)", function(next) { | ||
client.repos.one( | ||
{ | ||
id: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
} | ||
); | ||
}); | ||
it("should successfully execute PATCH /repos/:user/:repo (update)", function(next) { | ||
@@ -149,3 +162,4 @@ client.repos.update( | ||
has_wiki: "Boolean", | ||
has_downloads: "Boolean" | ||
has_downloads: "Boolean", | ||
default_branch: "String" | ||
}, | ||
@@ -273,3 +287,3 @@ function(err, res) { | ||
it("should successfully execute GET /repos/:user/:repo/branches/:branch (getBranch)", function(next) { | ||
client.repos.getBranches( | ||
client.repos.getBranch( | ||
{ | ||
@@ -358,5 +372,7 @@ user: "String", | ||
path: "String", | ||
author: "String", | ||
page: "Number", | ||
per_page: "Number", | ||
author: "String" | ||
since: "Date", | ||
until: "Date" | ||
}, | ||
@@ -531,11 +547,12 @@ function(err, res) { | ||
}); | ||
it("should successfully execute GET /repos/:user/:repo/contents/:path (createContent)", function(next) { | ||
client.repos.getContent( | ||
it("should successfully execute PUT /repos/:user/:repo/contents/:path (createContent)", function(next) { | ||
client.repos.createContent( | ||
{ | ||
user: "String", | ||
repo: "String", | ||
content: "String", | ||
message: "String", | ||
path: "String", | ||
ref: "String", | ||
content:"String", | ||
message:"String" | ||
ref: "String" | ||
}, | ||
@@ -616,2 +633,3 @@ function(err, res) { | ||
repo: "String", | ||
ref: "String", | ||
archive_format: "String" | ||
@@ -845,4 +863,4 @@ }, | ||
it("should successfully execute PUT /user/starred/:user/:repo (watch)", function(next) { | ||
client.repos.watch( | ||
it("should successfully execute PUT /user/starred/:user/:repo (star)", function(next) { | ||
client.repos.star( | ||
{ | ||
@@ -860,4 +878,4 @@ user: "String", | ||
it("should successfully execute DELETE /user/starred/:user/:repo (unWatch)", function(next) { | ||
client.repos.unWatch( | ||
it("should successfully execute DELETE /user/starred/:user/:repo (unStar)", function(next) { | ||
client.repos.unStar( | ||
{ | ||
@@ -1133,2 +1151,76 @@ user: "String", | ||
}); | ||
it("should successfully execute GET /repos/:user/:repo/deployments (getDeployments)", function(next) { | ||
client.repos.getDeployments( | ||
{ | ||
sha: "String", | ||
ref: "String", | ||
task: "String", | ||
environment: "String", | ||
user: "String", | ||
repo: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
} | ||
); | ||
}); | ||
it("should successfully execute POST /repos/:user/:repo/deployments (createDeployment)", function(next) { | ||
client.repos.createDeployment( | ||
{ | ||
ref: "String", | ||
task: "String", | ||
auto_merge: "Boolean", | ||
required_contexts: "Array", | ||
payload: "String", | ||
environment: "String", | ||
description: "String", | ||
user: "String", | ||
repo: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
} | ||
); | ||
}); | ||
it("should successfully execute GET /repos/:user/:repo/deployments/:id/statuses (getDeploymentStatuses)", function(next) { | ||
client.repos.getDeploymentStatuses( | ||
{ | ||
user: "String", | ||
repo: "String", | ||
id: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
} | ||
); | ||
}); | ||
it("should successfully execute POST /repos/:user/:repo/deployments/:id/statuses (createDeploymentStatus)", function(next) { | ||
client.repos.createDeploymentStatus( | ||
{ | ||
state: "String", | ||
target_url: "String", | ||
description: "String", | ||
user: "String", | ||
repo: "String", | ||
id: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
} | ||
); | ||
}); | ||
}); |
@@ -13,3 +13,3 @@ /* | ||
var Assert = require("assert"); | ||
var Client = require("./../index"); | ||
var Client = require("./../../index"); | ||
@@ -28,13 +28,14 @@ describe("[search]", function() { | ||
it("should successfully execute GET /search/code/:q (code)", function(next) { | ||
it("should successfully execute GET /search/code (code)", function(next) { | ||
client.search.code( | ||
{ | ||
q: ['test', 'repo:mikedeboertest/1423836276146'].join('+') | ||
q: "String", | ||
sort: "String", | ||
order: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.items.length, 1); | ||
var file = res.items[0]; | ||
Assert.equal(file.name, "TEST.md"); | ||
// other assertions go here | ||
next(); | ||
@@ -45,14 +46,14 @@ } | ||
it("should successfully execute GET /search/issues/:q (issues)", function(next) { | ||
it("should successfully execute GET /search/issues (issues)", function(next) { | ||
client.search.issues( | ||
{ | ||
q: ['debate', 'repo:mikedeboertest/node_chat', 'state:open'].join('+') | ||
q: "String", | ||
sort: "String", | ||
order: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.items.length, 1); | ||
var issue = res.items[0]; | ||
Assert.equal(issue.title, "My First Issue"); | ||
Assert.equal(issue.state, "open"); | ||
// other assertions go here | ||
next(); | ||
@@ -63,12 +64,14 @@ } | ||
it("should successfully execute GET /search/repositories/:q (repos)", function(next) { | ||
it("should successfully execute GET /search/repositories (repos)", function(next) { | ||
client.search.repos( | ||
{ | ||
q: ['pasta', 'language:JavaScript'].join('+') | ||
q: "String", | ||
sort: "String", | ||
order: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.ok(res.items.length > 0); | ||
Assert.equal(res.items[0].language, "JavaScript"); | ||
// other assertions go here | ||
next(); | ||
@@ -79,28 +82,15 @@ } | ||
it("should successfully execute GET /search/users/:q (users)", function(next) { | ||
it("should successfully execute GET /search/users (users)", function(next) { | ||
client.search.users( | ||
{ | ||
q: "mikedeboer" | ||
q: "String", | ||
sort: "String", | ||
order: "String", | ||
page: "Number", | ||
per_page: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
Assert.equal(res.items.length, 2); | ||
var user = res.items[0]; | ||
Assert.equal(user.login, "mikedeboer"); | ||
client.search.users( | ||
{ | ||
q: "location:Jyväskylä" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
//XXX: this is likely to change often. I added this for | ||
// issue #159. | ||
Assert.equal(res.items.length, 30); | ||
var user = res.items[0]; | ||
Assert.equal(user.login, "bebraw"); | ||
next(); | ||
} | ||
); | ||
// other assertions go here | ||
next(); | ||
} | ||
@@ -110,3 +100,3 @@ ); | ||
/*it("should successfully execute GET /search/user/email/:email (email)", function(next) { | ||
it("should successfully execute GET /legacy/user/email/:email (email)", function(next) { | ||
client.search.email( | ||
@@ -122,3 +112,3 @@ { | ||
); | ||
});*/ | ||
}); | ||
}); |
@@ -13,3 +13,3 @@ /* | ||
var Assert = require("assert"); | ||
var Client = require("./../index"); | ||
var Client = require("./../../index"); | ||
@@ -31,5 +31,5 @@ describe("[statuses]", function() { | ||
{ | ||
user: "mikedeboer", | ||
repo: "node-github", | ||
sha: "30d607d8fd8002427b61273f25d442c233cbf631" | ||
user: "String", | ||
repo: "String", | ||
sha: "String" | ||
}, | ||
@@ -44,8 +44,8 @@ function(err, res) { | ||
it("should successfully execute GET /repos/:user/:repo/commits/:sha/status (get)", function(next) { | ||
it("should successfully execute GET /repos/:user/:repo/commits/:sha/status (getCombined)", function(next) { | ||
client.statuses.getCombined( | ||
{ | ||
user: "mikedeboer", | ||
repo: "node-github", | ||
sha: "30d607d8fd8002427b61273f25d442c233cbf631" | ||
user: "String", | ||
repo: "String", | ||
sha: "String" | ||
}, | ||
@@ -68,3 +68,4 @@ function(err, res) { | ||
target_url: "String", | ||
description: "String" | ||
description: "String", | ||
context: "String" | ||
}, | ||
@@ -71,0 +72,0 @@ function(err, res) { |
@@ -13,3 +13,3 @@ /* | ||
var Assert = require("assert"); | ||
var Client = require("./../index"); | ||
var Client = require("./../../index"); | ||
@@ -28,2 +28,15 @@ describe("[user]", function() { | ||
it("should successfully execute GET /users (getAll)", function(next) { | ||
client.user.getAll( | ||
{ | ||
since: "Number" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
} | ||
); | ||
}); | ||
it("should successfully execute GET /users/:user (getFrom)", function(next) { | ||
@@ -86,2 +99,16 @@ client.user.getFrom( | ||
it("should successfully execute PATCH /user/memberships/orgs/:org (editOrganizationMembership)", function(next) { | ||
client.user.editOrganizationMembership( | ||
{ | ||
org: "String", | ||
state: "String" | ||
}, | ||
function(err, res) { | ||
Assert.equal(err, null); | ||
// other assertions go here | ||
next(); | ||
} | ||
); | ||
}); | ||
it("should successfully execute GET /user/teams (getTeams)", function(next) { | ||
@@ -88,0 +115,0 @@ client.user.getTeams( |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
3
147
5
1
294975
28
8682
- Removedoauth@^0.9.14
- Removedoauth@0.9.15(transitive)