From 7359b468e44e291ca829e49a48c948e727b825c6 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Sat, 9 May 2020 14:05:27 +0200 Subject: [PATCH] ESLint fixes for tests :rotating_light: Signed-off-by: David Mehren --- src/test/csp.ts | 16 ++++++++-------- src/test/letter-avatars.ts | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/test/csp.ts b/src/test/csp.ts index 737bea152..52a4b6789 100644 --- a/src/test/csp.ts +++ b/src/test/csp.ts @@ -5,8 +5,8 @@ import assert from 'assert' import crypto from 'crypto' import fs from 'fs' import path from 'path' -import * as configModule from '../lib/config'; -import { ImportMock } from 'ts-mock-imports'; +import * as configModule from '../lib/config' +import { ImportMock } from 'ts-mock-imports' describe('Content security policies', function () { let defaultConfig, csp @@ -36,7 +36,7 @@ describe('Content security policies', function () { it('Disable CDN', function () { const testconfig = defaultConfig testconfig.useCDN = false - ImportMock.mockOther(configModule, 'config', testconfig); + ImportMock.mockOther(configModule, 'config', testconfig) assert(!csp.computeDirectives().scriptSrc.includes('https://cdnjs.cloudflare.com')) assert(!csp.computeDirectives().scriptSrc.includes('https://cdn.mathjax.org')) @@ -49,7 +49,7 @@ describe('Content security policies', function () { it('Disable Google Analytics', function () { const testconfig = defaultConfig testconfig.csp.addGoogleAnalytics = false - ImportMock.mockOther(configModule, 'config', testconfig); + ImportMock.mockOther(configModule, 'config', testconfig) assert(!csp.computeDirectives().scriptSrc.includes('https://www.google-analytics.com')) }) @@ -57,7 +57,7 @@ describe('Content security policies', function () { it('Disable Disqus', function () { const testconfig = defaultConfig testconfig.csp.addDisqus = false - ImportMock.mockOther(configModule, 'config', testconfig); + ImportMock.mockOther(configModule, 'config', testconfig) assert(!csp.computeDirectives().scriptSrc.includes('https://disqus.com')) assert(!csp.computeDirectives().scriptSrc.includes('https://*.disqus.com')) @@ -69,14 +69,14 @@ describe('Content security policies', function () { it('Set ReportURI', function () { const testconfig = defaultConfig testconfig.csp.reportURI = 'https://example.com/reportURI' - ImportMock.mockOther(configModule, 'config', testconfig); + ImportMock.mockOther(configModule, 'config', testconfig) assert.strictEqual(csp.computeDirectives().reportUri, 'https://example.com/reportURI') }) it('Set own directives', function () { const testconfig = defaultConfig - ImportMock.mockOther(configModule, 'config', testconfig); + ImportMock.mockOther(configModule, 'config', testconfig) const unextendedCSP = csp.computeDirectives() testconfig.csp.directives = { defaultSrc: ['https://default.example.com'], @@ -89,7 +89,7 @@ describe('Content security policies', function () { childSrc: ['https://child.example.com'], connectSrc: ['https://connect.example.com'] } - ImportMock.mockOther(configModule, 'config', testconfig); + ImportMock.mockOther(configModule, 'config', testconfig) const variations = ['default', 'script', 'img', 'style', 'font', 'object', 'media', 'child', 'connect'] diff --git a/src/test/letter-avatars.ts b/src/test/letter-avatars.ts index 62eae4647..0f4f7604b 100644 --- a/src/test/letter-avatars.ts +++ b/src/test/letter-avatars.ts @@ -5,18 +5,18 @@ import { ImportMock } from 'ts-mock-imports' import * as configModule from '../lib/config' -const assert = require('assert') -const avatars = require('../lib/letter-avatars') +import assert from 'assert' +import * as avatars from '../lib/letter-avatars' describe('generateAvatarURL() gravatar enabled', function () { beforeEach(function () { // Reset config to make sure we don't influence other tests - let testconfig = { + const testconfig = { allowGravatar: true, serverURL: 'http://localhost:3000', port: 3000 } - ImportMock.mockOther(configModule, 'config', testconfig); + ImportMock.mockOther(configModule, 'config', testconfig) }) it('should return correct urls', function () { @@ -32,12 +32,12 @@ describe('generateAvatarURL() gravatar enabled', function () { describe('generateAvatarURL() gravatar disabled', function () { beforeEach(function () { // Reset config to make sure we don't influence other tests - let testconfig = { + const testconfig = { allowGravatar: false, serverURL: 'http://localhost:3000', port: 3000 } - ImportMock.mockOther(configModule, 'config', testconfig); + ImportMock.mockOther(configModule, 'config', testconfig) }) it('should return correct urls', function () {