mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-24 17:36:14 -04:00
tests: remove loadSettings.js for backend tests.
The old loadSettings.js was a way of customizing settings upon load, because the Settings module did not offer this functionality. But it did not work well, since all the default settings were not loaded. Let's get rid of loadSettings.js for the bulk of the tests (the "backend" specs). For the "container" specs, we'll keep it in place until/if we rewrite Settings.js making it less brittle.
This commit is contained in:
parent
419f17371c
commit
44186edbc5
8 changed files with 23 additions and 35 deletions
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* ACHTUNG: there is a copied & modified version of this file in
|
||||
* <basedir>/tests/container/loadSettings.js
|
||||
*
|
||||
* TODO: unify those two files, and merge in a single one.
|
||||
*/
|
||||
|
||||
var jsonminify = require(__dirname+"/../../src/node_modules/jsonminify");
|
||||
const fs = require('fs');
|
||||
|
||||
function loadSettings(){
|
||||
var settingsStr = fs.readFileSync(__dirname+"/../../settings.json").toString();
|
||||
// try to parse the settings
|
||||
try {
|
||||
if(settingsStr) {
|
||||
settingsStr = jsonminify(settingsStr).replace(",]","]").replace(",}","}");
|
||||
var settings = JSON.parse(settingsStr);
|
||||
|
||||
return settings;
|
||||
}
|
||||
}catch(e){
|
||||
console.error("whoops something is bad with settings");
|
||||
}
|
||||
}
|
||||
|
||||
exports.loadSettings = loadSettings;
|
|
@ -9,7 +9,7 @@
|
|||
const assert = require('assert');
|
||||
const supertest = require(__dirname + '/../../../../src/node_modules/supertest');
|
||||
const fs = require('fs');
|
||||
const settings = require(__dirname + '/../../loadSettings').loadSettings();
|
||||
const settings = require(__dirname + '/../../../../src/node/utils/Settings');
|
||||
const api = supertest('http://' + settings.ip + ':' + settings.port);
|
||||
const path = require('path');
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
const assert = require('assert');
|
||||
const supertest = require(__dirname+'/../../../../src/node_modules/supertest');
|
||||
const fs = require('fs');
|
||||
const settings = require(__dirname+'/../../loadSettings').loadSettings();
|
||||
const settings = require(__dirname + '/../../../../src/node/utils/Settings');
|
||||
const api = supertest('http://'+settings.ip+":"+settings.port);
|
||||
const path = require('path');
|
||||
const async = require(__dirname+'/../../../../src/node_modules/async');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
var assert = require('assert')
|
||||
supertest = require(__dirname+'/../../../../src/node_modules/supertest'),
|
||||
fs = require('fs'),
|
||||
settings = require(__dirname+'/../../loadSettings').loadSettings(),
|
||||
settings = require(__dirname + '/../../../../src/node/utils/Settings'),
|
||||
api = supertest('http://'+settings.ip+":"+settings.port),
|
||||
path = require('path');
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
const assert = require('assert');
|
||||
const supertest = require(__dirname+'/../../../../src/node_modules/supertest');
|
||||
const fs = require('fs');
|
||||
const settings = require(__dirname+'/../../loadSettings').loadSettings();
|
||||
const settings = require(__dirname + '/../../../../src/node/utils/Settings');
|
||||
const api = supertest('http://'+settings.ip+":"+settings.port);
|
||||
const path = require('path');
|
||||
const async = require(__dirname+'/../../../../src/node_modules/async');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
var assert = require('assert')
|
||||
supertest = require(__dirname+'/../../../../src/node_modules/supertest'),
|
||||
fs = require('fs'),
|
||||
settings = require(__dirname+'/../../loadSettings').loadSettings(),
|
||||
settings = require(__dirname + '/../../../../src/node/utils/Settings'),
|
||||
api = supertest('http://'+settings.ip+":"+settings.port),
|
||||
path = require('path');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue