From dd815892f296c785b3ac98b7bb70b0f4ac6ef474 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 24 Jan 2021 01:29:24 -0500 Subject: [PATCH] tests: Delete erroneous `describe()` calls `describe()` is meant to be used by independent tests, but the tests in this file are not independent. Add a higher-level `describe()` call and delete all of the `describe()` calls that wrap a single test. --- tests/backend/specs/api/importexport.js | 30 ++++++++++--------------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/tests/backend/specs/api/importexport.js b/tests/backend/specs/api/importexport.js index 870a715b2..fefd146f3 100644 --- a/tests/backend/specs/api/importexport.js +++ b/tests/backend/specs/api/importexport.js @@ -227,15 +227,15 @@ const testImports = { describe(__filename, function () { Object.keys(testImports).forEach((testName) => { - const testPadId = makeid(); - const test = testImports[testName]; - if (test.disabled) { - return xit(`DISABLED: ${testName}`, function (done) { - done(); - }); - } - describe(`createPad ${testName}`, function () { - it('creates a new Pad', function (done) { + describe(testName, function () { + const testPadId = makeid(); + const test = testImports[testName]; + if (test.disabled) { + return xit(`DISABLED: ${testName}`, function (done) { + done(); + }); + } + it('createPad', function (done) { api.get(`${endPoint('createPad')}&padID=${testPadId}`) .expect((res) => { if (res.body.code !== 0) throw new Error('Unable to create new Pad'); @@ -243,10 +243,8 @@ describe(__filename, function () { .expect('Content-Type', /json/) .expect(200, done); }); - }); - describe(`setHTML ${testName}`, function () { - it('Sets the HTML', function (done) { + it('setHTML', function (done) { api.get(`${endPoint('setHTML')}&padID=${testPadId}&html=${encodeURIComponent(test.input)}`) .expect((res) => { if (res.body.code !== 0) throw new Error(`Error:${testName}`); @@ -254,10 +252,8 @@ describe(__filename, function () { .expect('Content-Type', /json/) .expect(200, done); }); - }); - describe(`getHTML ${testName}`, function () { - it('Gets back the HTML of a Pad', function (done) { + it('getHTML', function (done) { api.get(`${endPoint('getHTML')}&padID=${testPadId}`) .expect((res) => { const receivedHtml = res.body.data.html; @@ -279,10 +275,8 @@ describe(__filename, function () { .expect('Content-Type', /json/) .expect(200, done); }); - }); - describe(`getText ${testName}`, function () { - it('Gets back the Text of a Pad', function (done) { + it('getText', function (done) { api.get(`${endPoint('getText')}&padID=${testPadId}`) .expect((res) => { const receivedText = res.body.data.text;