mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 08:26:16 -04:00
tests: Delete test pad before attempting import
This commit is contained in:
parent
c4b25388ae
commit
fc498f0ae6
1 changed files with 8 additions and 7 deletions
|
@ -25,6 +25,13 @@ const apiVersion = 1;
|
||||||
const testPadId = makeid();
|
const testPadId = makeid();
|
||||||
const testPadIdEnc = encodeURIComponent(testPadId);
|
const testPadIdEnc = encodeURIComponent(testPadId);
|
||||||
|
|
||||||
|
const deleteTestPad = async () => {
|
||||||
|
if (await padManager.doesPadExist(testPadId)) {
|
||||||
|
const pad = await padManager.getPad(testPadId);
|
||||||
|
await pad.remove();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
describe(__filename, function () {
|
describe(__filename, function () {
|
||||||
this.timeout(45000);
|
this.timeout(45000);
|
||||||
before(async function () { agent = await common.init(); });
|
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
|
// makeGoodExport() is assumed to produce good .etherpad records. Verify that assumption so
|
||||||
// that a buggy makeGoodExport() doesn't cause checks to accidentally pass.
|
// that a buggy makeGoodExport() doesn't cause checks to accidentally pass.
|
||||||
const records = makeGoodExport();
|
const records = makeGoodExport();
|
||||||
|
await deleteTestPad();
|
||||||
await importEtherpad(records)
|
await importEtherpad(records)
|
||||||
.expect(200)
|
.expect(200)
|
||||||
.expect('Content-Type', /json/)
|
.expect('Content-Type', /json/)
|
||||||
|
@ -430,13 +438,6 @@ describe(__filename, function () {
|
||||||
describe('Import authorization checks', function () {
|
describe('Import authorization checks', function () {
|
||||||
let authorize;
|
let authorize;
|
||||||
|
|
||||||
const deleteTestPad = async () => {
|
|
||||||
if (await padManager.doesPadExist(testPadId)) {
|
|
||||||
const pad = await padManager.getPad(testPadId);
|
|
||||||
await pad.remove();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const createTestPad = async (text) => {
|
const createTestPad = async (text) => {
|
||||||
const pad = await padManager.getPad(testPadId);
|
const pad = await padManager.getPad(testPadId);
|
||||||
if (text) await pad.setText(text);
|
if (text) await pad.setText(text);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue