use reporter

This commit is contained in:
John McLear 2021-01-26 11:09:22 +00:00
commit 697bfd979b
60 changed files with 1520 additions and 1395 deletions

View file

@ -1,4 +1,4 @@
/* global __dirname, __filename, afterEach, before, beforeEach, describe, it, require */
'use strict';
/*
* Import and Export tests for the /p/whateverPadId/import and /p/whateverPadId/export endpoints.
@ -6,11 +6,11 @@
const assert = require('assert').strict;
const common = require('../../common');
const superagent = require(`${__dirname}/../../../../src/node_modules/superagent`);
const superagent = require('ep_etherpad-lite/node_modules/superagent');
const fs = require('fs');
const settings = require(`${__dirname}/../../../../src/node/utils/Settings`);
const padManager = require(`${__dirname}/../../../../src/node/db/PadManager`);
const plugins = require(`${__dirname}/../../../../src/static/js/pluginfw/plugin_defs`);
const settings = require('ep_etherpad-lite/node/utils/Settings');
const padManager = require('ep_etherpad-lite/node/db/PadManager');
const plugins = require('ep_etherpad-lite/static/js/pluginfw/plugin_defs');
const padText = fs.readFileSync('../tests/backend/specs/api/test.txt');
const etherpadDoc = fs.readFileSync('../tests/backend/specs/api/test.etherpad');
@ -122,7 +122,7 @@ describe(__filename, function () {
describe('Import/Export tests requiring AbiWord/LibreOffice', function () {
before(function () {
before(async function () {
if ((!settings.abiword || settings.abiword.indexOf('/') === -1) &&
(!settings.soffice || settings.soffice.indexOf('/') === -1)) {
this.skip();
@ -149,7 +149,8 @@ describe(__filename, function () {
await agent.post(`/p/${testPadId}/import`)
.attach('file', wordXDoc, {
filename: '/test.docx',
contentType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
contentType:
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
})
.expect(200)
.expect(/FrameCall\('undefined', 'ok'\);/);
@ -352,7 +353,7 @@ describe(__filename, function () {
}); // End of tests.
var endPoint = function (point, version) {
const endPoint = (point, version) => {
version = version || apiVersion;
return `/api/${version}/${point}?apikey=${apiKey}`;
};

View file

@ -1,27 +1,26 @@
const assert = require('assert');
os = require('os'),
fs = require('fs'),
path = require('path'),
TidyHtml = null,
Settings = null;
'use strict';
const npm = require('../../../../src/node_modules/npm/lib/npm.js');
const nodeify = require('../../../../src/node_modules/nodeify');
const assert = require('assert');
const os = require('os');
const fs = require('fs');
const path = require('path');
let TidyHtml;
let Settings;
const npm = require('ep_etherpad-lite/node_modules/npm/lib/npm.js');
const nodeify = require('ep_etherpad-lite/node_modules/nodeify');
describe(__filename, function () {
describe('tidyHtml', function () {
before(function (done) {
npm.load({}, (err) => {
assert.ok(!err);
TidyHtml = require('../../../../src/node/utils/TidyHtml');
Settings = require('../../../../src/node/utils/Settings');
TidyHtml = require('ep_etherpad-lite/node/utils/TidyHtml');
Settings = require('ep_etherpad-lite/node/utils/Settings');
return done();
});
});
function tidy(file, callback) {
return nodeify(TidyHtml.tidy(file), callback);
}
const tidy = (file, callback) => nodeify(TidyHtml.tidy(file), callback);
it('Tidies HTML', function (done) {
// If the user hasn't configured Tidy, we skip this tests as it's required for this test
@ -53,7 +52,7 @@ describe(__filename, function () {
'</html>',
].join('\n');
assert.notStrictEqual(cleanedHtml.indexOf(expectedHtml), -1);
return done();
done();
});
});
@ -65,7 +64,7 @@ describe(__filename, function () {
tidy('/some/none/existing/file.html', (err) => {
assert.ok(err);
return done();
done();
});
});
});