forked from github-tools/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrate-limit.spec.js
More file actions
35 lines (28 loc) · 943 Bytes
/
rate-limit.spec.js
File metadata and controls
35 lines (28 loc) · 943 Bytes
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
import expect from 'must';
import Github from '../lib/GitHub';
import testUser from './fixtures/user.js';
import {assertSuccessful} from './helpers/callbacks';
describe('RateLimit', function() {
let github;
let rateLimit;
before(function() {
github = new Github({
username: testUser.USERNAME,
password: testUser.PASSWORD,
auth: 'basic',
});
rateLimit = github.getRateLimit();
});
it('should get rate limit', function(done) {
rateLimit.getRateLimit(assertSuccessful(done, function(err, rateInfo) {
const rate = rateInfo.rate;
expect(rate).to.be.an.object();
expect(rate).to.have.own('limit');
expect(rate).to.have.own('remaining');
expect(rate.limit).to.be.a.number();
expect(rate.remaining).to.be.a.number();
expect(rate.remaining).to.be.at.most(rateInfo.rate.limit);
done();
}));
});
});