Skip to content

Commit 699d092

Browse files
committed
Convert rateLimit test to async / await
1 parent 4fca61d commit 699d092

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

test/rate-limit.spec.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import expect from 'must';
22

33
import Github from '../lib/GitHub';
44
import testUser from './fixtures/user.json';
5-
import {assertSuccessful} from './helpers/callbacks';
65

76
describe('RateLimit', function() {
87
let github;
@@ -18,18 +17,15 @@ describe('RateLimit', function() {
1817
rateLimit = github.getRateLimit();
1918
});
2019

21-
it('should get rate limit', function(done) {
22-
rateLimit.getRateLimit(assertSuccessful(done, function(err, rateInfo) {
23-
const rate = rateInfo.rate;
20+
it('should get rate limit', async function() {
21+
const {data: rateInfo} = await rateLimit.getRateLimit();
22+
const rate = rateInfo.rate;
2423

25-
expect(rate).to.be.an.object();
26-
expect(rate).to.have.own('limit');
27-
expect(rate).to.have.own('remaining');
28-
expect(rate.limit).to.be.a.number();
29-
expect(rate.remaining).to.be.a.number();
30-
expect(rate.remaining).to.be.at.most(rateInfo.rate.limit);
31-
32-
done();
33-
}));
24+
expect(rate).to.be.an.object();
25+
expect(rate).to.have.own('limit');
26+
expect(rate).to.have.own('remaining');
27+
expect(rate.limit).to.be.a.number();
28+
expect(rate.remaining).to.be.a.number();
29+
expect(rate.remaining).to.be.at.most(rateInfo.rate.limit);
3430
});
3531
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy