From da3804390fc9827128153efe3dbc854015c2ca93 Mon Sep 17 00:00:00 2001 From: Phillip Johnsen Date: Mon, 25 Mar 2019 20:39:59 +0100 Subject: [PATCH] tests: refactor to prove integration tests w/nock scope fails The most important changes introduced here is to make sure absolutely *every* nock scope (read: outgoing HTTP request) gets asserted. Previously that was not the case, as only the *first* nock scope was verified, all the other ones has actually not been verified at all. That's what these changes proves; no source code changes has been done, it's only being sure that all nock scopes are actually verified. --- test/integration/node-labels-webhook.test.js | 19 +++++++++++++++---- .../integration/trigger-jenkins-build.test.js | 5 ++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/test/integration/node-labels-webhook.test.js b/test/integration/node-labels-webhook.test.js index 5d05e1de..ea5cf60e 100644 --- a/test/integration/node-labels-webhook.test.js +++ b/test/integration/node-labels-webhook.test.js @@ -44,7 +44,7 @@ tap.test('Sends POST request to https://api.github.com/repos/nodejs/node/issues/ .reply(200) t.plan(1) - t.tearDown(() => filesScope.done() && existingRepoLabelsScope.done() && newLabelsScope.done() && clock.uninstall()) + t.tearDown(() => clock.uninstall()) supertest(app) .post('/hooks/github') @@ -53,6 +53,9 @@ tap.test('Sends POST request to https://api.github.com/repos/nodejs/node/issues/ .expect(200) .end((err, res) => { clock.runAll() + filesScope.done() + existingRepoLabelsScope.done() + newLabelsScope.done() t.equal(err, null) }) }) @@ -78,7 +81,7 @@ tap.test('Adds v6.x label when PR is targeting the v6.x-staging branch', (t) => .reply(200) t.plan(1) - t.tearDown(() => filesScope.done() && existingRepoLabelsScope.done() && newLabelsScope.done() && clock.uninstall()) + t.tearDown(() => clock.uninstall()) supertest(app) .post('/hooks/github') @@ -87,6 +90,9 @@ tap.test('Adds v6.x label when PR is targeting the v6.x-staging branch', (t) => .expect(200) .end((err, res) => { clock.runAll() + filesScope.done() + existingRepoLabelsScope.done() + newLabelsScope.done() t.equal(err, null) }) }) @@ -107,7 +113,7 @@ tap.test('Does not create labels which does not already exist', (t) => { .reply(200, readFixture('repo-labels.json')) t.plan(1) - t.tearDown(() => filesScope.done() && existingRepoLabelsScope.done() && clock.uninstall()) + t.tearDown(() => clock.uninstall()) supertest(app) .post('/hooks/github') @@ -116,6 +122,8 @@ tap.test('Does not create labels which does not already exist', (t) => { .expect(200) .end((err, res) => { clock.runAll() + filesScope.done() + existingRepoLabelsScope.done() t.equal(err, null) }) }) @@ -142,7 +150,7 @@ tap.test('Adds V8 Engine label when PR has deps/v8 file changes', (t) => { .reply(200) t.plan(1) - t.tearDown(() => filesScope.done() && existingRepoLabelsScope.done() && newLabelsScope.done() && clock.uninstall()) + t.tearDown(() => clock.uninstall()) supertest(app) .post('/hooks/github') @@ -151,6 +159,9 @@ tap.test('Adds V8 Engine label when PR has deps/v8 file changes', (t) => { .expect(200) .end((err, res) => { clock.runAll() + filesScope.done() + existingRepoLabelsScope.done() + newLabelsScope.done() t.equal(err, null) }) }) diff --git a/test/integration/trigger-jenkins-build.test.js b/test/integration/trigger-jenkins-build.test.js index b4051198..f6f2d7a6 100644 --- a/test/integration/trigger-jenkins-build.test.js +++ b/test/integration/trigger-jenkins-build.test.js @@ -44,7 +44,7 @@ tap.test('Sends POST request to https://ci.nodejs.org', (t) => { .reply(200) t.plan(1) - t.tearDown(() => collaboratorsScope.done() && ciJobScope.done() && commentScope.done() && clock.uninstall()) + t.tearDown(() => clock.uninstall()) supertest(app) .post('/hooks/github') @@ -55,6 +55,9 @@ tap.test('Sends POST request to https://ci.nodejs.org', (t) => { process.env.JENKINS_JOB_URL_NODE = originalJobUrlValue process.env.JENKINS_BUILD_TOKEN_NODE = originalTokenValue clock.runAll() + collaboratorsScope.done() + ciJobScope.done() + commentScope.done() t.equal(err, null) }) }) 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