From de04d5ee105353dbfe1fe53335971fa0ce5f8eec Mon Sep 17 00:00:00 2001 From: miyajan Date: Mon, 18 Sep 2017 18:03:40 +0900 Subject: [PATCH] chore: fix broken tests --- lib/Requestable.js | 2 +- test/organization.spec.js | 6 ++++-- test/team.spec.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Requestable.js b/lib/Requestable.js index bad111ac..44702b94 100644 --- a/lib/Requestable.js +++ b/lib/Requestable.js @@ -256,7 +256,7 @@ class Requestable { results.push(...thisGroup); const nextUrl = getNextPage(response.headers.link); - if (nextUrl && typeof options.page !== 'number') { + if (nextUrl && !(options && typeof options.page !== 'number')) { log(`getting next page: ${nextUrl}`); return this._requestAllPages(nextUrl, options, cb, results); } diff --git a/test/organization.spec.js b/test/organization.spec.js index 26fd3607..710ebbcf 100644 --- a/test/organization.spec.js +++ b/test/organization.spec.js @@ -17,11 +17,13 @@ describe('Organization', function() { password: testUser.PASSWORD, auth: 'basic', }); - return; + createdProject = undefined; }); after(function() { - return github.getProject(createdProject.id).deleteProject(); + if (createdProject) { + return github.getProject(createdProject.id).deleteProject(); + } }); describe('reading', function() { diff --git a/test/team.spec.js b/test/team.spec.js index 8a5ec8be..8f975384 100644 --- a/test/team.spec.js +++ b/test/team.spec.js @@ -159,7 +159,7 @@ describe('Team', function() { // Isolate tests that need a new team per test }); it('should add membership for a given user', function() { - return team.addMembership(testUser.USERNAME) + return team.addMembership(altUser.USERNAME) .then(({data}) => { const {state, role} = data; expect(state === 'active' || state === 'pending').to.be.true();