forked from octokit/octokit.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub_test.js
executable file
·39 lines (32 loc) · 1.13 KB
/
github_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* Copyright 2010 Ajax.org B.V.
*
* This product includes software developed by
* Ajax.org B.V. (http://www.ajax.org/).
*
* Author: Fabian Jaokbs <[email protected]>
*/
"use strict";
var assert = require("assert");
var GitHubApi = require("./github").GitHubApi;
var test = module.exports = {
"test: create API instance" : function() {
var api = new GitHubApi();
assert.ok(api instanceof GitHubApi);
},
"test loading a repository" : function(finished) {
var github = new GitHubApi();
github.get('repos/show/ornicar/php-github-api', null, null, function(err, repo) {
assert.equal(repo['repository']['name'], 'php-github-api', 'Found information about php-github-api repo');
finished();
});
},
"test loading a non existing repository should return an error" : function(finished) {
var github = new GitHubApi();
github.get('non-existing-url/for-sure', null, null, function(err, repo) {
assert.ok(err !== undefined);
finished();
});
}
};
!module.parent && require("asyncjs").test.testcase(module.exports).exec();