From fc498f0ae67c06d00ab3a797252b61e7890779c5 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 17 Dec 2021 23:41:45 -0500 Subject: [PATCH] tests: Delete test pad before attempting import --- .../backend/specs/api/importexportGetPost.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/tests/backend/specs/api/importexportGetPost.js b/src/tests/backend/specs/api/importexportGetPost.js index 98244b22b..11498384d 100644 --- a/src/tests/backend/specs/api/importexportGetPost.js +++ b/src/tests/backend/specs/api/importexportGetPost.js @@ -25,6 +25,13 @@ const apiVersion = 1; const testPadId = makeid(); const testPadIdEnc = encodeURIComponent(testPadId); +const deleteTestPad = async () => { + if (await padManager.doesPadExist(testPadId)) { + const pad = await padManager.getPad(testPadId); + await pad.remove(); + } +}; + describe(__filename, function () { this.timeout(45000); before(async function () { agent = await common.init(); }); @@ -364,6 +371,7 @@ describe(__filename, function () { // makeGoodExport() is assumed to produce good .etherpad records. Verify that assumption so // that a buggy makeGoodExport() doesn't cause checks to accidentally pass. const records = makeGoodExport(); + await deleteTestPad(); await importEtherpad(records) .expect(200) .expect('Content-Type', /json/) @@ -430,13 +438,6 @@ describe(__filename, function () { describe('Import authorization checks', function () { let authorize; - const deleteTestPad = async () => { - if (await padManager.doesPadExist(testPadId)) { - const pad = await padManager.getPad(testPadId); - await pad.remove(); - } - }; - const createTestPad = async (text) => { const pad = await padManager.getPad(testPadId); if (text) await pad.setText(text);