lint: Run eslint --fix on bin/ and tests/

This commit is contained in:
Richard Hansen 2020-11-23 13:21:51 -05:00 committed by John McLear
parent 0625739cb8
commit b8d07a42eb
78 changed files with 4319 additions and 4599 deletions

View file

@ -4,27 +4,27 @@
* Section "GLOBAL FUNCTIONS" in src/node/db/API.js
*/
const common = require('../../common');
const supertest = require(__dirname+'/../../../../src/node_modules/supertest');
const settings = require(__dirname+'/../../../../src/node/utils/Settings');
const api = supertest('http://'+settings.ip+":"+settings.port);
const supertest = require(`${__dirname}/../../../../src/node_modules/supertest`);
const settings = require(`${__dirname}/../../../../src/node/utils/Settings`);
const api = supertest(`http://${settings.ip}:${settings.port}`);
const apiKey = common.apiKey;
var apiVersion = '1.2.14';
const apiVersion = '1.2.14';
describe(__filename, function() {
describe('Connectivity for instance-level API tests', function() {
it('can connect', function(done) {
describe(__filename, function () {
describe('Connectivity for instance-level API tests', function () {
it('can connect', function (done) {
api.get('/api/')
.expect('Content-Type', /json/)
.expect(200, done)
.expect(200, done);
});
});
describe('getStats', function() {
it('Gets the stats of a running instance', function(done) {
describe('getStats', function () {
it('Gets the stats of a running instance', function (done) {
api.get(endPoint('getStats'))
.expect(function(res) {
if (res.body.code !== 0) throw new Error("getStats() failed");
.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)}`);
@ -44,7 +44,7 @@ describe(__filename, function() {
});
});
var endPoint = function(point, version){
var endPoint = function (point, version) {
version = version || apiVersion;
return '/api/'+version+'/'+point+'?apikey='+apiKey;
}
return `/api/${version}/${point}?apikey=${apiKey}`;
};