Visitar URL original
Add ability to add collaborator by mtscout6 · Pull Request #462 · github-tools/github · GitHub
Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Convert rateLimit test to async / await
  • Loading branch information
mtscout6 committed Jul 16, 2017
commit 699d092e3240f0da78f37e2739bbef1111ee1d2e
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);
});
});