diff --git a/package.json b/package.json index 06381b4..fd9280b 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ "dev:bash": "nodemon -x 'npm test ; npm start'", "start": "ts-node src/index.ts", "tsc": "tsc -p tsconfig.json", - "lint": "eslint src", - "lint:fix": "eslint src --fix" + "lint": "eslint src test", + "lint:fix": "eslint src test --fix" }, "author": "Ajay Ramachandran", "license": "MIT", diff --git a/test/cases/getSkipSegments.ts b/test/cases/getSkipSegments.ts index c4a741c..407ce3e 100644 --- a/test/cases/getSkipSegments.ts +++ b/test/cases/getSkipSegments.ts @@ -326,7 +326,7 @@ describe('getSkipSegments', () => { else done(); } }) - .catch(err => done("Couldn't call endpoint")); + .catch(() => done("Couldn't call endpoint")); }); it('Should be able to get specific segments with repeating requiredSegment', (done: Done) => { @@ -341,6 +341,6 @@ describe('getSkipSegments', () => { else done(); } }) - .catch(err => done("Couldn't call endpoint")); + .catch(() => done("Couldn't call endpoint")); }); }); diff --git a/test/cases/getSkipSegmentsByHash.ts b/test/cases/getSkipSegmentsByHash.ts index 1aeb780..e2891ab 100644 --- a/test/cases/getSkipSegmentsByHash.ts +++ b/test/cases/getSkipSegmentsByHash.ts @@ -252,7 +252,7 @@ describe('getSegmentsByHash', () => { } } }) - .catch(err => ("Couldn't call endpoint")); + .catch(() => ("Couldn't call endpoint")); }); it('Should be able to get specific segments with requiredSegments', (done: Done) => { @@ -268,7 +268,7 @@ describe('getSegmentsByHash', () => { else done(); } }) - .catch(err => done("Couldn't call endpoint")); + .catch(() => done("Couldn't call endpoint")); }); it('Should be able to get specific segments with repeating requiredSegment', (done: Done) => { @@ -284,6 +284,6 @@ describe('getSegmentsByHash', () => { else done(); } }) - .catch(err => done("Couldn't call endpoint")); + .catch(() => done("Couldn't call endpoint")); }); }); diff --git a/test/cases/getUserInfo.ts b/test/cases/getUserInfo.ts index f641e1b..2c21250 100644 --- a/test/cases/getUserInfo.ts +++ b/test/cases/getUserInfo.ts @@ -165,7 +165,7 @@ describe('getUserInfo', () => { const data = await res.json(); for (const value in data) { if (data[value] === null && value !== "lastSegmentID") { - done(`returned null for ${value}`) + done(`returned null for ${value}`); } } done(); // pass diff --git a/test/cases/setUsername.ts b/test/cases/setUsername.ts index 5216dd0..b3e5ad4 100644 --- a/test/cases/setUsername.ts +++ b/test/cases/setUsername.ts @@ -46,6 +46,7 @@ async function getLastLogUserNameChange(userID: string) { } function wellFormatUserName(userName: string) { + // eslint-disable-next-line no-control-regex return userName.replace(/[\u0000-\u001F\u007F-\u009F]/g, ''); } diff --git a/test/mocks.ts b/test/mocks.ts index dfa449b..b96861b 100644 --- a/test/mocks.ts +++ b/test/mocks.ts @@ -1,5 +1,6 @@ import express from 'express'; import {config} from '../src/config'; +import { Server } from 'http'; const app = express(); @@ -46,6 +47,6 @@ app.post('/CustomWebhook', (req, res) => { res.sendStatus(200); }); -export function createMockServer(callback: () => void) { +export function createMockServer(callback: () => void): Server { return app.listen(config.mockPort, callback); } diff --git a/test/test.ts b/test/test.ts index 59fd5f0..bba97ab 100644 --- a/test/test.ts +++ b/test/test.ts @@ -18,15 +18,15 @@ async function init() { })); // delete old test database - if (fs.existsSync(config.db)) fs.unlinkSync(config.db) + if (fs.existsSync(config.db)) fs.unlinkSync(config.db); if (fs.existsSync(config.privateDB)) fs.unlinkSync(config.privateDB); await initDb(); const dbMode = config.mysql ? 'mysql' : config.postgres ? 'postgres' - : 'sqlite' - Logger.info('Database Mode: ' + dbMode) + : 'sqlite'; + Logger.info('Database Mode: ' + dbMode); // Instantiate a Mocha instance. const mocha = new Mocha();