forked from github-tools/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.spec.js
More file actions
80 lines (68 loc) · 1.98 KB
/
search.spec.js
File metadata and controls
80 lines (68 loc) · 1.98 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import expect from 'must';
import nock from 'nock';
import Github from '../lib/GitHub';
import testUser from './fixtures/user.js';
describe('Search', function() {
this.timeout(20 * 1000); // eslint-disable-line no-invalid-this
let github;
before(function() {
github = new Github({
username: testUser.USERNAME,
password: testUser.PASSWORD,
auth: 'basic',
});
nock.load('test/fixtures/search.json');
});
it('should search repositories', function() {
let options;
let search = github.search({
q: 'tetris language:assembly',
sort: 'stars',
order: 'desc',
});
return search.forRepositories(options)
.then(function({data}) {
expect(data).to.be.an.array();
expect(data.length).to.be.above(0);
});
});
it('should search code', function() {
let options;
let search = github.search({
q: 'addClass in:file language:js repo:jquery/jquery',
});
return search.forCode(options)
.then(function({data}) {
expect(data).to.be.an.array();
expect(data.length).to.be.above(0);
});
});
it('should search issues', function() {
let options;
let search = github.search({
q: 'windows pip label:bug language:python state:open ',
sort: 'created',
order: 'asc',
});
return search.forIssues(options)
.then(function({data}) {
expect(data).to.be.an.array();
expect(data.length).to.be.above(0);
});
});
it('should search users', function() {
let options;
let search = github.search({
q: 'tom repos:>42 followers:>1000',
});
return search.forUsers(options)
.then(function({data}) {
expect(data).to.be.an.array();
expect(data.length).to.be.above(0);
});
});
after(function() {
nock.cleanAll();
nock.restore();
});
});