mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-24 17:36:14 -04:00
lint: Run eslint --fix
on bin/
and tests/
This commit is contained in:
parent
0625739cb8
commit
b8d07a42eb
78 changed files with 4319 additions and 4599 deletions
|
@ -12,16 +12,16 @@
|
|||
* back to a default)
|
||||
*/
|
||||
|
||||
var jsonminify = require(__dirname+"/../../src/node_modules/jsonminify");
|
||||
const jsonminify = require(`${__dirname}/../../src/node_modules/jsonminify`);
|
||||
const fs = require('fs');
|
||||
|
||||
function loadSettings(){
|
||||
var settingsStr = fs.readFileSync(__dirname+"/../../settings.json.docker").toString();
|
||||
function loadSettings() {
|
||||
let settingsStr = fs.readFileSync(`${__dirname}/../../settings.json.docker`).toString();
|
||||
// try to parse the settings
|
||||
try {
|
||||
if(settingsStr) {
|
||||
settingsStr = jsonminify(settingsStr).replace(",]","]").replace(",}","}");
|
||||
var settings = JSON.parse(settingsStr);
|
||||
if (settingsStr) {
|
||||
settingsStr = jsonminify(settingsStr).replace(',]', ']').replace(',}', '}');
|
||||
const settings = JSON.parse(settingsStr);
|
||||
|
||||
// custom settings for running in a container
|
||||
settings.ip = 'localhost';
|
||||
|
@ -29,8 +29,8 @@ function loadSettings(){
|
|||
|
||||
return settings;
|
||||
}
|
||||
}catch(e){
|
||||
console.error("whoops something is bad with settings");
|
||||
} catch (e) {
|
||||
console.error('whoops something is bad with settings');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,34 +5,34 @@
|
|||
* TODO: unify those two files, and merge in a single one.
|
||||
*/
|
||||
|
||||
const supertest = require(__dirname+'/../../../../src/node_modules/supertest');
|
||||
const settings = require(__dirname+'/../../loadSettings').loadSettings();
|
||||
const api = supertest('http://'+settings.ip+":"+settings.port);
|
||||
const supertest = require(`${__dirname}/../../../../src/node_modules/supertest`);
|
||||
const settings = require(`${__dirname}/../../loadSettings`).loadSettings();
|
||||
const api = supertest(`http://${settings.ip}:${settings.port}`);
|
||||
|
||||
var apiVersion = 1;
|
||||
const apiVersion = 1;
|
||||
|
||||
describe('Connectivity', function(){
|
||||
it('can connect', function(done) {
|
||||
describe('Connectivity', function () {
|
||||
it('can connect', function (done) {
|
||||
api.get('/api/')
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200, done)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200, done);
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('API Versioning', function(){
|
||||
it('finds the version tag', function(done) {
|
||||
describe('API Versioning', function () {
|
||||
it('finds the version tag', function (done) {
|
||||
api.get('/api/')
|
||||
.expect(function(res){
|
||||
if (!res.body.currentVersion) throw new Error("No version set in API");
|
||||
return;
|
||||
})
|
||||
.expect(200, done)
|
||||
.expect((res) => {
|
||||
if (!res.body.currentVersion) throw new Error('No version set in API');
|
||||
return;
|
||||
})
|
||||
.expect(200, done);
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('Permission', function(){
|
||||
it('errors with invalid APIKey', function(done) {
|
||||
api.get('/api/'+apiVersion+'/createPad?apikey=wrong_password&padID=test')
|
||||
.expect(401, done)
|
||||
describe('Permission', function () {
|
||||
it('errors with invalid APIKey', function (done) {
|
||||
api.get(`/api/${apiVersion}/createPad?apikey=wrong_password&padID=test`)
|
||||
.expect(401, done);
|
||||
});
|
||||
})
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue