mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
lint: Fix ESLint errors in backend tests
This commit is contained in:
parent
00d45e3229
commit
3d2f77f75d
7 changed files with 79 additions and 78 deletions
|
@ -1,3 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
/*
|
||||
* Tests for the instance-level APIs
|
||||
*
|
||||
|
@ -12,6 +14,8 @@ const api = supertest(`http://${settings.ip}:${settings.port}`);
|
|||
const apiKey = common.apiKey;
|
||||
const apiVersion = '1.2.14';
|
||||
|
||||
const endPoint = (point, version) => `/api/${version || apiVersion}/${point}?apikey=${apiKey}`;
|
||||
|
||||
describe(__filename, function () {
|
||||
describe('Connectivity for instance-level API tests', function () {
|
||||
it('can connect', function (done) {
|
||||
|
@ -29,16 +33,21 @@ describe(__filename, function () {
|
|||
.expect((res) => {
|
||||
if (res.body.code !== 0) throw new Error('getStats() failed');
|
||||
|
||||
if (!(('totalPads' in res.body.data) && (typeof res.body.data.totalPads === 'number'))) {
|
||||
throw new Error(`Response to getStats() does not contain field totalPads, or it's not a number: ${JSON.stringify(res.body.data)}`);
|
||||
if (!('totalPads' in res.body.data && typeof res.body.data.totalPads === 'number')) {
|
||||
throw new Error('Response to getStats() does not contain field totalPads, or ' +
|
||||
`it's not a number: ${JSON.stringify(res.body.data)}`);
|
||||
}
|
||||
|
||||
if (!(('totalSessions' in res.body.data) && (typeof res.body.data.totalSessions === 'number'))) {
|
||||
throw new Error(`Response to getStats() does not contain field totalSessions, or it's not a number: ${JSON.stringify(res.body.data)}`);
|
||||
if (!('totalSessions' in res.body.data &&
|
||||
typeof res.body.data.totalSessions === 'number')) {
|
||||
throw new Error('Response to getStats() does not contain field totalSessions, or ' +
|
||||
`it's not a number: ${JSON.stringify(res.body.data)}`);
|
||||
}
|
||||
|
||||
if (!(('totalActivePads' in res.body.data) && (typeof res.body.data.totalActivePads === 'number'))) {
|
||||
throw new Error(`Response to getStats() does not contain field totalActivePads, or it's not a number: ${JSON.stringify(res.body.data)}`);
|
||||
if (!('totalActivePads' in res.body.data &&
|
||||
typeof res.body.data.totalActivePads === 'number')) {
|
||||
throw new Error('Response to getStats() does not contain field totalActivePads, or ' +
|
||||
`it's not a number: ${JSON.stringify(res.body.data)}`);
|
||||
}
|
||||
})
|
||||
.expect('Content-Type', /json/)
|
||||
|
@ -46,8 +55,3 @@ describe(__filename, function () {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
var endPoint = function (point, version) {
|
||||
version = version || apiVersion;
|
||||
return `/api/${version}/${point}?apikey=${apiKey}`;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue