mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
tests: Include the filename in the test output
Also some minor consistency cleanups.
This commit is contained in:
parent
50e402193b
commit
3e14016214
13 changed files with 2296 additions and 2276 deletions
|
@ -18,6 +18,7 @@ var apiVersion = 1;
|
|||
|
||||
var testPadId = makeid();
|
||||
|
||||
describe(__filename, function() {
|
||||
describe('API Versioning', function() {
|
||||
it('errors if can not connect', function(done) {
|
||||
api
|
||||
|
@ -58,6 +59,7 @@ describe('jsonp support', function() {
|
|||
.expect(200, done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
var endPoint = function(point) {
|
||||
return '/api/' + apiVersion + '/' + point + '?apikey=' + apiKey;
|
||||
|
|
|
@ -14,6 +14,7 @@ const apiKey = common.apiKey;
|
|||
var apiVersion = 1;
|
||||
var testPadId = makeid();
|
||||
|
||||
describe(__filename, function() {
|
||||
describe('Connectivity For Character Encoding', function() {
|
||||
it('can connect', function(done) {
|
||||
api.get('/api/')
|
||||
|
@ -84,6 +85,7 @@ describe('getHTML', function(){
|
|||
.expect(200, done)
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
/*
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ var authorID = "";
|
|||
var padID = makeid();
|
||||
var timestamp = Date.now();
|
||||
|
||||
describe(__filename, function() {
|
||||
describe('API Versioning', function(){
|
||||
it('errors if can not connect', function(done) {
|
||||
api.get('/api/')
|
||||
|
@ -94,6 +95,7 @@ describe('getChatHistory', function(){
|
|||
.expect(200, done)
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
var endPoint = function(point){
|
||||
return '/api/'+apiVersion+'/'+point+'?apikey='+apiKey;
|
||||
|
|
|
@ -56,6 +56,7 @@ var testImports = {
|
|||
*/
|
||||
}
|
||||
|
||||
describe(__filename, function() {
|
||||
Object.keys(testImports).forEach(function(testName) {
|
||||
var testPadId = makeid();
|
||||
test = testImports[testName];
|
||||
|
@ -131,6 +132,7 @@ Object.keys(testImports).forEach(function (testName) {
|
|||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var endPoint = function(point, version){
|
||||
|
|
|
@ -23,6 +23,7 @@ var apiVersion = 1;
|
|||
const testPadId = makeid();
|
||||
const testPadIdEnc = encodeURIComponent(testPadId);
|
||||
|
||||
describe(__filename, function() {
|
||||
before(async function() { agent = await common.init(); });
|
||||
|
||||
describe('Connectivity', function(){
|
||||
|
@ -342,7 +343,7 @@ describe('Imports and Exports', function(){
|
|||
assert.equal(pad.text(), 'before import\n');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}); // End of tests.
|
||||
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ const api = supertest('http://'+settings.ip+":"+settings.port);
|
|||
const apiKey = common.apiKey;
|
||||
var apiVersion = '1.2.14';
|
||||
|
||||
describe(__filename, function() {
|
||||
describe('Connectivity for instance-level API tests', function() {
|
||||
it('can connect', function(done) {
|
||||
api.get('/api/')
|
||||
|
@ -41,6 +42,7 @@ describe('getStats', function(){
|
|||
.expect(200, done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
var endPoint = function(point, version){
|
||||
version = version || apiVersion;
|
||||
|
|
|
@ -43,6 +43,7 @@ var ulSpaceHtml = '<!doctype html><html><body><ul class="bullet"> <li>one</li></
|
|||
*/
|
||||
var expectedSpaceHtml = '<!doctype html><html><body><ul class="bullet"><li>one</ul></body></html>';
|
||||
|
||||
describe(__filename, function() {
|
||||
describe('Connectivity', function() {
|
||||
it('can connect', function(done) {
|
||||
api.get('/api/')
|
||||
|
@ -779,6 +780,7 @@ describe('copyPadWithoutHistory', function(){
|
|||
});
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
/*
|
||||
-> movePadForce Test
|
||||
|
|
|
@ -11,6 +11,7 @@ let authorID = '';
|
|||
let sessionID = '';
|
||||
let padID = makeid();
|
||||
|
||||
describe(__filename, function() {
|
||||
describe('API Versioning', function() {
|
||||
it('errors if can not connect', async function() {
|
||||
await api.get('/api/')
|
||||
|
@ -280,6 +281,7 @@ describe('API: Misc', function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ var assert = require('assert')
|
|||
var npm = require("../../../../src/node_modules/npm/lib/npm.js");
|
||||
var nodeify = require('../../../../src/node_modules/nodeify');
|
||||
|
||||
describe(__filename, function() {
|
||||
describe('tidyHtml', function() {
|
||||
before(function(done) {
|
||||
npm.load({}, function(err) {
|
||||
|
@ -68,3 +69,4 @@ describe('tidyHtml', function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -105,10 +105,9 @@ const tests = {
|
|||
|
||||
}
|
||||
|
||||
// For each test..
|
||||
describe(__filename, function() {
|
||||
for (let test in tests) {
|
||||
let testObj = tests[test];
|
||||
|
||||
describe(test, function() {
|
||||
if (testObj.disabled) {
|
||||
return xit("DISABLED:", test, function(done){
|
||||
|
@ -150,10 +149,9 @@ for (let test in tests){
|
|||
throw new Error();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@ function m(mod) { return __dirname + '/../../../src/' + mod; }
|
|||
const assert = require('assert').strict;
|
||||
const promises = require(m('node/utils/promises'));
|
||||
|
||||
describe('promises.timesLimit', async () => {
|
||||
describe(__filename, function() {
|
||||
describe('promises.timesLimit', function() {
|
||||
let wantIndex = 0;
|
||||
const testPromises = [];
|
||||
const makePromise = (index) => {
|
||||
|
@ -24,18 +25,18 @@ describe('promises.timesLimit', async () => {
|
|||
const concurrency = 7;
|
||||
const timesLimitPromise = promises.timesLimit(total, concurrency, makePromise);
|
||||
|
||||
it('honors concurrency', async () => {
|
||||
it('honors concurrency', async function() {
|
||||
assert.equal(wantIndex, concurrency);
|
||||
});
|
||||
|
||||
it('creates another when one completes', async () => {
|
||||
it('creates another when one completes', async function() {
|
||||
const {promise, resolve} = testPromises.shift();
|
||||
resolve();
|
||||
await promise;
|
||||
assert.equal(wantIndex, concurrency + 1);
|
||||
});
|
||||
|
||||
it('creates the expected total number of promises', async () => {
|
||||
it('creates the expected total number of promises', async function() {
|
||||
while (testPromises.length > 0) {
|
||||
// Resolve them in random order to ensure that the resolution order doesn't matter.
|
||||
const i = Math.floor(Math.random() * Math.floor(testPromises.length));
|
||||
|
@ -46,11 +47,11 @@ describe('promises.timesLimit', async () => {
|
|||
assert.equal(wantIndex, total);
|
||||
});
|
||||
|
||||
it('resolves', async () => {
|
||||
it('resolves', async function() {
|
||||
await timesLimitPromise;
|
||||
});
|
||||
|
||||
it('does not create too many promises if total < concurrency', async () => {
|
||||
it('does not create too many promises if total < concurrency', async function() {
|
||||
wantIndex = 0;
|
||||
assert.equal(testPromises.length, 0);
|
||||
const total = 7;
|
||||
|
@ -65,21 +66,22 @@ describe('promises.timesLimit', async () => {
|
|||
assert.equal(wantIndex, total);
|
||||
});
|
||||
|
||||
it('accepts total === 0, concurrency > 0', async () => {
|
||||
it('accepts total === 0, concurrency > 0', async function() {
|
||||
wantIndex = 0;
|
||||
assert.equal(testPromises.length, 0);
|
||||
await promises.timesLimit(0, concurrency, makePromise);
|
||||
assert.equal(wantIndex, 0);
|
||||
});
|
||||
|
||||
it('accepts total === 0, concurrency === 0', async () => {
|
||||
it('accepts total === 0, concurrency === 0', async function() {
|
||||
wantIndex = 0;
|
||||
assert.equal(testPromises.length, 0);
|
||||
await promises.timesLimit(0, 0, makePromise);
|
||||
assert.equal(wantIndex, 0);
|
||||
});
|
||||
|
||||
it('rejects total > 0, concurrency === 0', async () => {
|
||||
it('rejects total > 0, concurrency === 0', async function() {
|
||||
await assert.rejects(promises.timesLimit(total, 0, makePromise), RangeError);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,9 +9,6 @@ const setCookieParser = require(m('node_modules/set-cookie-parser'));
|
|||
const settings = require(m('node/utils/Settings'));
|
||||
|
||||
const logger = common.logger;
|
||||
let agent;
|
||||
|
||||
before(async function() { agent = await common.init(); });
|
||||
|
||||
// Waits for and returns the next named socket.io event. Rejects if there is any error while waiting
|
||||
// (unless waiting for that error event).
|
||||
|
@ -92,6 +89,10 @@ const handshake = async (socket, padID) => {
|
|||
return msg;
|
||||
};
|
||||
|
||||
describe(__filename, function() {
|
||||
let agent;
|
||||
before(async function() { agent = await common.init(); });
|
||||
|
||||
describe('socket.io access checks', function() {
|
||||
let authorize;
|
||||
let authorizeHooksBackup;
|
||||
|
@ -353,3 +354,4 @@ describe('socket.io access checks', function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -5,8 +5,8 @@ const common = require('../common');
|
|||
const plugins = require(m('static/js/pluginfw/plugin_defs'));
|
||||
const settings = require(m('node/utils/Settings'));
|
||||
|
||||
describe(__filename, function() {
|
||||
let agent;
|
||||
|
||||
before(async function() { agent = await common.init(); });
|
||||
|
||||
describe('webaccess: without plugins', function() {
|
||||
|
@ -442,3 +442,4 @@ describe('webaccess: authnFailure, authzFailure, authFailure hooks', function()
|
|||
assert(!handlers['authFailure'].called);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue