Skip to content
This repository was archived by the owner on Oct 20, 2023. It is now read-only.

Commit 136b1d3

Browse files
committed
Optimized issues tests
1 parent 19b539f commit 136b1d3

File tree

1 file changed

+21
-23
lines changed

1 file changed

+21
-23
lines changed

test/test.issue.js

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ var testUser = require('./user.json');
55
var github, issues;
66

77
describe('Github.Issue', function() {
8+
var issue;
9+
810
before(function() {
911
github = new Github({
1012
username: testUser.USERNAME,
@@ -21,45 +23,41 @@ describe('Github.Issue', function() {
2123
xhr.should.be.instanceof(XMLHttpRequest);
2224
issues.should.have.length.above(0);
2325

26+
issue = issues[0];
27+
2428
done();
2529
});
2630
});
2731

2832
it('should post issue comment', function(done) {
29-
issues.list({}, function(err, issuesList) {
30-
issues.comment(issuesList[0], 'Comment test', function(err, res, xhr) {
31-
should.not.exist(err);
32-
xhr.should.be.instanceof(XMLHttpRequest);
33-
res.body.should.equal('Comment test');
33+
issues.comment(issue, 'Comment test', function(err, res, xhr) {
34+
should.not.exist(err);
35+
xhr.should.be.instanceof(XMLHttpRequest);
36+
res.body.should.equal('Comment test');
3437

35-
done();
36-
});
38+
done();
3739
});
3840
});
3941

4042
it('should edit issues title', function(done) {
41-
issues.list({}, function(err, issuesList) {
42-
issues.edit(issuesList[0].number, {
43-
title: 'Edited title'
44-
}, function(err, res, xhr) {
45-
should.not.exist(err);
46-
xhr.should.be.instanceof(XMLHttpRequest);
47-
res.title.should.equal('Edited title');
43+
issues.edit(issue.number, {
44+
title: 'Edited title'
45+
}, function(err, res, xhr) {
46+
should.not.exist(err);
47+
xhr.should.be.instanceof(XMLHttpRequest);
48+
res.title.should.equal('Edited title');
4849

49-
done();
50-
});
50+
done();
5151
});
5252
});
5353

5454
it('should get issue', function(done) {
55-
issues.list({}, function(err, issuesList) {
56-
issues.get(issuesList[0].number, function(err, res, xhr) {
57-
should.not.exist(err);
58-
xhr.should.be.instanceof(XMLHttpRequest);
59-
res.number.should.equal(issuesList[0].number);
55+
issues.get(issue.number, function(err, res, xhr) {
56+
should.not.exist(err);
57+
xhr.should.be.instanceof(XMLHttpRequest);
58+
res.number.should.equal(issue.number);
6059

61-
done();
62-
});
60+
done();
6361
});
6462
});
6563
});

0 commit comments

Comments
 (0)