From 699d092e3240f0da78f37e2739bbef1111ee1d2e Mon Sep 17 00:00:00 2001 From: Matt Smith Date: Sun, 16 Jul 2017 17:39:29 -0600 Subject: [PATCH] Convert rateLimit test to async / await --- test/rate-limit.spec.js | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/test/rate-limit.spec.js b/test/rate-limit.spec.js index c3a5b858..40219fea 100644 --- a/test/rate-limit.spec.js +++ b/test/rate-limit.spec.js @@ -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; @@ -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); }); });