Skip to content

Commit

Permalink
Convert rateLimit test to async / await
Browse files Browse the repository at this point in the history
  • Loading branch information
mtscout6 committed Jul 16, 2017
1 parent 957282f commit f0642ce
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions test/rate-limit.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import expect from 'must';

import Github from '../lib/GitHub';
import testUser from './fixtures/user.json';
import {assertSuccessful} from './helpers/callbacks';

describe('RateLimit', function() {
let github;
Expand All @@ -18,18 +17,15 @@ describe('RateLimit', function() {
rateLimit = github.getRateLimit();
});

it('should get rate limit', function(done) {
rateLimit.getRateLimit(assertSuccessful(done, function(err, rateInfo) {
const rate = rateInfo.rate;
it('should get rate limit', async function() {
const {data: rateInfo} = await rateLimit.getRateLimit();
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();
}));
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);
});
});

0 comments on commit f0642ce

Please sign in to comment.