Skip to content

Commit 83450c8

Browse files
committed
Updated tests to verify the presence of the XHR object
1 parent 60a3447 commit 83450c8

File tree

6 files changed

+174
-70
lines changed

6 files changed

+174
-70
lines changed

test/test.gist.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ describe('Github.Gist', function() {
1818
});
1919

2020
it('should read gist', function(done) {
21-
gist.read(function(err, res) {
21+
gist.read(function(err, res, xhr) {
2222
should.not.exist(err);
23+
xhr.should.be.instanceof(XMLHttpRequest);
2324
res.should.have.property('description', 'This is a test gist');
2425
res.files['README.md'].should.have.property('content', 'Hello World');
2526

@@ -28,8 +29,9 @@ describe('Github.Gist', function() {
2829
});
2930

3031
it('should star', function(done) {
31-
gist.star(function(err) {
32+
gist.star(function(err, res, xhr) {
3233
should.not.exist(err);
34+
xhr.should.be.instanceof(XMLHttpRequest);
3335

3436
gist.isStarred(function(err) {
3537
should.not.exist(err);
@@ -58,11 +60,13 @@ describe('Creating new Github.Gist', function() {
5860
}
5961
};
6062

61-
gist.create(gistData, function(err, res) {
63+
gist.create(gistData, function(err, res, xhr) {
6264
should.not.exist(err);
65+
xhr.should.be.instanceof(XMLHttpRequest);
6366
res.should.have.property('description', gistData.description);
6467
res.should.have.property('public', gistData.public);
6568
res.should.have.property('id').to.be.a('string');
69+
6670
done();
6771
});
6872
});
@@ -90,8 +94,9 @@ describe('deleting a Github.Gist', function() {
9094
});
9195

9296
it('should delete gist', function(done) {
93-
gist.delete(function(err) {
97+
gist.delete(function(err, res, xhr) {
9498
should.not.exist(err);
99+
xhr.should.be.instanceof(XMLHttpRequest);
95100

96101
done();
97102
});

test/test.issue.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,22 @@ describe('Github.Issue', function() {
1616
});
1717

1818
it('should list issues', function(done) {
19-
issues.list({}, function(err, issues) {
19+
issues.list({}, function(err, issues, xhr) {
2020
should.not.exist(err);
21+
xhr.should.be.instanceof(XMLHttpRequest);
2122
issues.should.have.length.above(0);
23+
2224
done();
2325
});
2426
});
2527

2628
it('should post issue comment', function(done) {
2729
issues.list({}, function(err, issuesList) {
28-
issues.comment(issuesList[0], 'Comment test', function(err, res) {
30+
issues.comment(issuesList[0], 'Comment test', function(err, res, xhr) {
2931
should.not.exist(err);
32+
xhr.should.be.instanceof(XMLHttpRequest);
3033
res.body.should.equal('Comment test');
34+
3135
done();
3236
});
3337
});

test/test.rate-limit.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@ describe('Github.RateLimit', function() {
1616
});
1717

1818
it('should get rate limit', function(done) {
19-
rateLimit.getRateLimit(function(err, rateInfo) {
19+
rateLimit.getRateLimit(function(err, rateInfo, xhr) {
2020
should.not.exist(err);
21+
xhr.should.be.instanceof(XMLHttpRequest);
2122
rateInfo.should.be.an('object');
2223
rateInfo.should.have.deep.property('rate.limit');
2324
rateInfo.rate.limit.should.be.a('number');
2425
rateInfo.should.have.deep.property('rate.remaining');
2526
rateInfo.rate.remaining.should.be.a('number');
2627
rateInfo.rate.remaining.should.be.at.most(rateInfo.rate.limit);
28+
2729
done();
2830
});
2931
});

0 commit comments

Comments
 (0)