From 091b1f100e3760609a49a5b31518328f3aad5541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Fri, 30 Apr 2021 20:26:52 +0200 Subject: [PATCH] Linting in tests --- test/t_Config/t_Toggles/t_ToggleBotBar.js | 16 ++--- .../t_Toggles/t_ToggleDetailedTime.js | 16 ++--- test/t_Config/t_Toggles/t_ToggleFavourites.js | 6 +- test/t_Config/t_Toggles/t_ToggleGCTimer.js | 16 ++--- .../t_Toggles/t_ToggleSectionHideButtons.js | 16 ++--- .../t_Config/t_Toggles/t_ToggleToolWarnPos.js | 16 ++--- .../t_Toggles/t_ToggleUpgradeBarAndColour.js | 22 +++---- .../t_Toggles/t_ToggleUpgradeBarFixedPos.js | 16 ++--- .../t_Toggles/t_ToggleWrinklerButtons.js | 36 +++++----- test/t_Disp/t_BeautifyFormatting.js | 66 +++++++++---------- test/t_Disp/t_GetTimeColour.js | 24 +++---- 11 files changed, 125 insertions(+), 125 deletions(-) diff --git a/test/t_Config/t_Toggles/t_ToggleBotBar.js b/test/t_Config/t_Toggles/t_ToggleBotBar.js index 0c3898d..d030a63 100644 --- a/test/t_Config/t_Toggles/t_ToggleBotBar.js +++ b/test/t_Config/t_Toggles/t_ToggleBotBar.js @@ -5,28 +5,28 @@ import { l, Game } from '../../GlobalsForTesting'; import ToggleBotBar from '../../../src/Config/Toggles/ToggleBotBar'; import { CMOptions } from '../../../src/Config/VariablesAndData'; -describe('ToggleBotBar', function () { +describe('ToggleBotBar', () => { global.l = l; global.Game = Game; - beforeEach(function () { + beforeEach(() => { global.domids = {}; ToggleBotBar(); }); - describe('BotBar = 0', function () { - before(function () { + describe('BotBar = 0', () => { + before(() => { CMOptions.BotBar = 0; }); - it('Toggle style correctly', function () { + it('Toggle style correctly', () => { assert.equal(domids.CMBotBar.style.display, 'none'); // eslint-disable-line no-undef }); }); - describe('BotBar = 1', function () { - before(function () { + describe('BotBar = 1', () => { + before(() => { CMOptions.BotBar = 1; }); - it('Toggle style correctly', function () { + it('Toggle style correctly', () => { assert.equal(domids.CMBotBar.style.display, ''); // eslint-disable-line no-undef }); }); diff --git a/test/t_Config/t_Toggles/t_ToggleDetailedTime.js b/test/t_Config/t_Toggles/t_ToggleDetailedTime.js index c9d5d0c..11bd539 100644 --- a/test/t_Config/t_Toggles/t_ToggleDetailedTime.js +++ b/test/t_Config/t_Toggles/t_ToggleDetailedTime.js @@ -6,27 +6,27 @@ import { CMOptions } from '../../../src/Config/VariablesAndData'; import ToggleDetailedTime from '../../../src/Config/Toggles/ToggleDetailedTime'; import { BackupFunctions } from '../../../src/Main/VariablesAndData'; -describe('ToggleDetailedTime', function () { +describe('ToggleDetailedTime', () => { global.Game = Game; - beforeEach(function () { + beforeEach(() => { ToggleDetailedTime(); }); - describe('DetailedTime = 0', function () { - before(function () { + describe('DetailedTime = 0', () => { + before(() => { CMOptions.DetailedTime = 0; BackupFunctions.sayTime = 'BackupFunctions.sayTime'; }); - it('Set correct time function', function () { + it('Set correct time function', () => { assert.equal(Game.sayTime, 'BackupFunctions.sayTime'); }); }); - describe('DetailedTime = 1', function () { - before(function () { + describe('DetailedTime = 1', () => { + before(() => { CMOptions.DetailedTime = 1; }); - it('Set correct time function', function () { + it('Set correct time function', () => { assert.equal(Game.sayTime.name, 'CMSayTime'); }); }); diff --git a/test/t_Config/t_Toggles/t_ToggleFavourites.js b/test/t_Config/t_Toggles/t_ToggleFavourites.js index cd0b011..3bce7b8 100644 --- a/test/t_Config/t_Toggles/t_ToggleFavourites.js +++ b/test/t_Config/t_Toggles/t_ToggleFavourites.js @@ -4,12 +4,12 @@ import { assert } from 'chai'; import ToggleFavouriteSetting from '../../../src/Config/Toggles/ToggleFavourites'; import { FavouriteSettings } from '../../../src/Disp/VariablesAndData'; -describe('ToggleFavouriteSetting', function () { - beforeEach(function () { +describe('ToggleFavouriteSetting', () => { + beforeEach(() => { global.domids = {}; }); // TODO: Can't write test for checking existing config due to Babel/Typescript problem - it('New config', function () { + it('New config', () => { FavouriteSettings.push('TestConfig'); ToggleFavouriteSetting('TestConfig2'); assert.deepEqual(FavouriteSettings, ['TestConfig', 'TestConfig2']); diff --git a/test/t_Config/t_Toggles/t_ToggleGCTimer.js b/test/t_Config/t_Toggles/t_ToggleGCTimer.js index 797c034..bb0dac4 100644 --- a/test/t_Config/t_Toggles/t_ToggleGCTimer.js +++ b/test/t_Config/t_Toggles/t_ToggleGCTimer.js @@ -7,10 +7,10 @@ import ToggleGCTimer from '../../../src/Config/Toggles/ToggleGCTimer'; import { GCTimers } from '../../../src/Disp/VariablesAndData'; import { CacheGoldenShimmersByID } from '../../../src/Cache/VariablesAndData'; -describe('ToggleGCTimer', function () { +describe('ToggleGCTimer', () => { global.l = l; - beforeEach(function () { + beforeEach(() => { global.domids = {}; GCTimers[0] = { style: {} }; GCTimers[1] = { style: {} }; @@ -23,20 +23,20 @@ describe('ToggleGCTimer', function () { ToggleGCTimer(); }); - describe('GCTimer = 0', function () { - before(function () { + describe('GCTimer = 0', () => { + before(() => { CMOptions.GCTimer = 0; }); - it('Toggle style correctly', function () { + it('Toggle style correctly', () => { assert.equal(GCTimers[0].style.display, 'none'); assert.equal(GCTimers[1].style.display, 'none'); }); }); - describe('GCTimer = 1', function () { - before(function () { + describe('GCTimer = 1', () => { + before(() => { CMOptions.GCTimer = 1; }); - it('Toggle style correctly', function () { + it('Toggle style correctly', () => { assert.equal(GCTimers[0].style.display, 'block'); assert.equal(GCTimers[0].style.left, 'Test00'); assert.equal(GCTimers[0].style.top, 'Test01'); diff --git a/test/t_Config/t_Toggles/t_ToggleSectionHideButtons.js b/test/t_Config/t_Toggles/t_ToggleSectionHideButtons.js index 70952ca..96b8df4 100644 --- a/test/t_Config/t_Toggles/t_ToggleSectionHideButtons.js +++ b/test/t_Config/t_Toggles/t_ToggleSectionHideButtons.js @@ -5,27 +5,27 @@ import { l } from '../../GlobalsForTesting'; import { CMOptions } from '../../../src/Config/VariablesAndData'; import ToggleSectionHideButtons from '../../../src/Config/Toggles/ToggleSectionHideButtons'; -describe('ToggleSectionHideButtons', function () { +describe('ToggleSectionHideButtons', () => { global.l = l; - beforeEach(function () { + beforeEach(() => { global.domids = {}; ToggleSectionHideButtons(); }); - describe('HideSectionsButtons = 0', function () { - before(function () { + describe('HideSectionsButtons = 0', () => { + before(() => { CMOptions.HideSectionsButtons = 0; }); - it('Toggle style correctly', function () { + it('Toggle style correctly', () => { assert.equal(domids.CMSectionHidButtons.style.display, 'none'); // eslint-disable-line no-undef }); }); - describe('HideSectionsButtons = 1', function () { - before(function () { + describe('HideSectionsButtons = 1', () => { + before(() => { CMOptions.HideSectionsButtons = 1; }); - it('Toggle style correctly', function () { + it('Toggle style correctly', () => { assert.equal(domids.CMSectionHidButtons.style.display, ''); // eslint-disable-line no-undef }); }); diff --git a/test/t_Config/t_Toggles/t_ToggleToolWarnPos.js b/test/t_Config/t_Toggles/t_ToggleToolWarnPos.js index caa12bf..498a4ff 100644 --- a/test/t_Config/t_Toggles/t_ToggleToolWarnPos.js +++ b/test/t_Config/t_Toggles/t_ToggleToolWarnPos.js @@ -5,29 +5,29 @@ import { l } from '../../GlobalsForTesting'; import { CMOptions } from '../../../src/Config/VariablesAndData'; import ToggleToolWarnPos from '../../../src/Config/Toggles/ToggleToolWarnPos'; -describe('ToggleToolWarnPos', function () { +describe('ToggleToolWarnPos', () => { global.l = l; - beforeEach(function () { + beforeEach(() => { global.domids = {}; ToggleToolWarnPos(); }); - describe('ToolWarnPos = 0', function () { - before(function () { + describe('ToolWarnPos = 0', () => { + before(() => { CMOptions.ToolWarnPos = 0; }); - it('Toggle style correctly', function () { + it('Toggle style correctly', () => { assert.equal(domids.CMDispTooltipWarningParent.style.top, 'auto'); // eslint-disable-line no-undef assert.equal(domids.CMDispTooltipWarningParent.style.margin, '4px -4px'); // eslint-disable-line no-undef assert.equal(domids.CMDispTooltipWarningParent.style.padding, '3px 4px'); // eslint-disable-line no-undef }); }); - describe('ToolWarnPos = 1', function () { - before(function () { + describe('ToolWarnPos = 1', () => { + before(() => { CMOptions.ToolWarnPos = 1; }); - it('Toggle style correctly', function () { + it('Toggle style correctly', () => { assert.equal(domids.CMDispTooltipWarningParent.style.right, 'auto'); // eslint-disable-line no-undef assert.equal(domids.CMDispTooltipWarningParent.style.margin, '4px'); // eslint-disable-line no-undef assert.equal(domids.CMDispTooltipWarningParent.style.padding, '4px 3px'); // eslint-disable-line no-undef diff --git a/test/t_Config/t_Toggles/t_ToggleUpgradeBarAndColour.js b/test/t_Config/t_Toggles/t_ToggleUpgradeBarAndColour.js index e0755ca..eda97f7 100644 --- a/test/t_Config/t_Toggles/t_ToggleUpgradeBarAndColour.js +++ b/test/t_Config/t_Toggles/t_ToggleUpgradeBarAndColour.js @@ -5,36 +5,36 @@ import { l, Game } from '../../GlobalsForTesting'; import { CMOptions } from '../../../src/Config/VariablesAndData'; import ToggleUpgradeBarAndColor from '../../../src/Config/Toggles/ToggleUpgradeBarAndColour'; -describe('ToggleUpgradeBarAndColor', function () { +describe('ToggleUpgradeBarAndColor', () => { global.l = l; global.Game = Game; - beforeEach(function () { + beforeEach(() => { global.domids = {}; ToggleUpgradeBarAndColor(); }); - describe('UpBarColor = 0', function () { - before(function () { + describe('UpBarColor = 0', () => { + before(() => { CMOptions.UpBarColor = 0; }); - it('Toggle style correctly', function () { + it('Toggle style correctly', () => { assert.equal(domids.CMUpgradeBar.style.display, 'none'); // eslint-disable-line no-undef }); }); - describe('UpBarColor = 1', function () { - before(function () { + describe('UpBarColor = 1', () => { + before(() => { CMOptions.UpBarColor = 1; }); - it('Toggle style correctly', function () { + it('Toggle style correctly', () => { assert.equal(domids.CMUpgradeBar.style.display, ''); // eslint-disable-line no-undef }); }); - describe('UpBarColor = 2', function () { - before(function () { + describe('UpBarColor = 2', () => { + before(() => { CMOptions.UpBarColor = 2; }); - it('Toggle style correctly', function () { + it('Toggle style correctly', () => { assert.equal(domids.CMUpgradeBar.style.display, 'none'); // eslint-disable-line no-undef }); }); diff --git a/test/t_Config/t_Toggles/t_ToggleUpgradeBarFixedPos.js b/test/t_Config/t_Toggles/t_ToggleUpgradeBarFixedPos.js index 438305d..15df564 100644 --- a/test/t_Config/t_Toggles/t_ToggleUpgradeBarFixedPos.js +++ b/test/t_Config/t_Toggles/t_ToggleUpgradeBarFixedPos.js @@ -5,27 +5,27 @@ import { l } from '../../GlobalsForTesting'; import { CMOptions } from '../../../src/Config/VariablesAndData'; import ToggleUpgradeBarFixedPos from '../../../src/Config/Toggles/ToggleUpgradeBarFixedPos'; -describe('ToggleUpgradeBarFixedPos', function () { +describe('ToggleUpgradeBarFixedPos', () => { global.l = l; - beforeEach(function () { + beforeEach(() => { global.domids = {}; ToggleUpgradeBarFixedPos(); }); - describe('UpgradeBarFixedPos = 0', function () { - before(function () { + describe('UpgradeBarFixedPos = 0', () => { + before(() => { CMOptions.UpgradeBarFixedPos = 0; }); - it('Toggle style correctly', function () { + it('Toggle style correctly', () => { assert.equal(domids.CMUpgradeBar.style.position, ''); // eslint-disable-line no-undef }); }); - describe('UpgradeBarFixedPos = 1', function () { - before(function () { + describe('UpgradeBarFixedPos = 1', () => { + before(() => { CMOptions.UpgradeBarFixedPos = 1; }); - it('Toggle style correctly', function () { + it('Toggle style correctly', () => { assert.equal(domids.CMUpgradeBar.style.position, 'sticky'); // eslint-disable-line no-undef assert.equal(domids.CMUpgradeBar.style.top, '0px'); // eslint-disable-line no-undef }); diff --git a/test/t_Config/t_Toggles/t_ToggleWrinklerButtons.js b/test/t_Config/t_Toggles/t_ToggleWrinklerButtons.js index 6ca22c2..26acc5b 100644 --- a/test/t_Config/t_Toggles/t_ToggleWrinklerButtons.js +++ b/test/t_Config/t_Toggles/t_ToggleWrinklerButtons.js @@ -5,56 +5,56 @@ import { l, Game } from '../../GlobalsForTesting'; import { CMOptions } from '../../../src/Config/VariablesAndData'; import ToggleWrinklerButtons from '../../../src/Config/Toggles/ToggleWrinklerButtons'; -describe('ToggleWrinklerButtons', function () { +describe('ToggleWrinklerButtons', () => { global.l = l; global.Game = Game; - beforeEach(function () { + beforeEach(() => { global.domids = {}; ToggleWrinklerButtons(); }); - describe('WrinklerButtons = 0', function () { - before(function () { + describe('WrinklerButtons = 0', () => { + before(() => { CMOptions.WrinklerButtons = 0; }); - describe('Game.elderWrath = 0', function () { - before(function () { + describe('Game.elderWrath = 0', () => { + before(() => { Game.elderWrath = 0; }); - it('Toggle style correctly', function () { + it('Toggle style correctly', () => { assert.equal(domids.PopAllNormalWrinklerButton.style.display, 'none'); // eslint-disable-line no-undef assert.equal(domids.PopFattestWrinklerButton.style.display, 'none'); // eslint-disable-line no-undef }); }); - describe('Game.elderWrath = 1', function () { - before(function () { + describe('Game.elderWrath = 1', () => { + before(() => { Game.elderWrath = 1; }); - it('Toggle style correctly', function () { + it('Toggle style correctly', () => { assert.equal(domids.PopAllNormalWrinklerButton.style.display, 'none'); // eslint-disable-line no-undef assert.equal(domids.PopFattestWrinklerButton.style.display, 'none'); // eslint-disable-line no-undef }); }); }); - describe('WrinklerButtons = 1', function () { - before(function () { + describe('WrinklerButtons = 1', () => { + before(() => { CMOptions.WrinklerButtons = 1; }); - describe('Game.elderWrath = 0', function () { - before(function () { + describe('Game.elderWrath = 0', () => { + before(() => { Game.elderWrath = 0; }); - it('Toggle style correctly', function () { + it('Toggle style correctly', () => { assert.equal(domids.PopAllNormalWrinklerButton.style.display, 'none'); // eslint-disable-line no-undef assert.equal(domids.PopFattestWrinklerButton.style.display, 'none'); // eslint-disable-line no-undef }); }); - describe('Game.elderWrath = 1', function () { - before(function () { + describe('Game.elderWrath = 1', () => { + before(() => { Game.elderWrath = 1; }); - it('Toggle style correctly', function () { + it('Toggle style correctly', () => { assert.equal(domids.PopAllNormalWrinklerButton.style.display, ''); // eslint-disable-line no-undef assert.equal(domids.PopFattestWrinklerButton.style.display, ''); // eslint-disable-line no-undef }); diff --git a/test/t_Disp/t_BeautifyFormatting.js b/test/t_Disp/t_BeautifyFormatting.js index 4629c1c..733df64 100644 --- a/test/t_Disp/t_BeautifyFormatting.js +++ b/test/t_Disp/t_BeautifyFormatting.js @@ -4,102 +4,102 @@ import { assert } from 'chai'; import FormatTime from '../../src/Disp/BeautifyAndFormatting/FormatTime'; import { CMOptions } from '../../src/Config/VariablesAndData'; -describe('FormatTime', function () { - it('Format when time is Infinity', function () { +describe('FormatTime', () => { + it('Format when time is Infinity', () => { assert.equal(FormatTime(Infinity, 0), Infinity); }); - it('Format when time is negative', function () { + it('Format when time is negative', () => { assert.equal(FormatTime(-1, 0), 'Negative time period'); }); - describe('TimeFormat = 0', function () { - before(function () { + describe('TimeFormat = 0', () => { + before(() => { CMOptions.TimeFormat = 0; }); - describe('Longformat = 0', function () { - it('Format when time is 0', function () { + describe('Longformat = 0', () => { + it('Format when time is 0', () => { assert.equal(FormatTime(0, 0), '0s'); }); - it('Format when time is 1 second', function () { + it('Format when time is 1 second', () => { assert.equal(FormatTime(1, 0), '1s'); }); - it('Format when time is over 1 minute', function () { + it('Format when time is over 1 minute', () => { assert.equal(FormatTime(61, 0), '1m, 1s'); }); - it('Format when time is over 1 hour', function () { + it('Format when time is over 1 hour', () => { assert.equal(FormatTime(3601, 0), '1h, 0m, 1s'); }); - it('Format when time is over 1 day', function () { + it('Format when time is over 1 day', () => { assert.equal(FormatTime(86401, 0), '1d, 0h, 0m, 1s'); }); - it('Format when time is over 1 year', function () { + it('Format when time is over 1 year', () => { assert.equal(FormatTime(31536001, 0), '1y, 0d, 0h, 0m, 1s'); }); - it('Format when time is over >9000 days', function () { + it('Format when time is over >9000 days', () => { assert.equal(FormatTime(777600001, 0), '>9000d'); }); - it('Format when time is over >99.9 years', function () { + it('Format when time is over >99.9 years', () => { assert.equal(FormatTime(3155760001, 0), '>9000d'); }); }); - describe('Longformat = 1', function () { - it('Format when time is 0', function () { + describe('Longformat = 1', () => { + it('Format when time is 0', () => { assert.equal(FormatTime(0, 1), '0 seconds'); }); - it('Format when time is 1 second', function () { + it('Format when time is 1 second', () => { assert.equal(FormatTime(1, 1), '1 second'); }); - it('Format when time is over 1 minute', function () { + it('Format when time is over 1 minute', () => { assert.equal(FormatTime(61, 1), '1 minute, 1 second'); }); - it('Format when time is over 1 hour', function () { + it('Format when time is over 1 hour', () => { assert.equal(FormatTime(3601, 1), '1 hour, 0 minutes, 1 second'); }); - it('Format when time is over 1 day', function () { + it('Format when time is over 1 day', () => { assert.equal( FormatTime(86401, 1), '1 day, 0 hours, 0 minutes, 1 second', ); }); - it('Format when time is over 1 year', function () { + it('Format when time is over 1 year', () => { assert.equal( FormatTime(31536001, 1), '1 year, 0 days, 0 hours, 0 minutes, 1 second', ); }); - it('Format when time is over >9000 days', function () { + it('Format when time is over >9000 days', () => { assert.equal(FormatTime(777600001, 1), 'Over 9000 days!'); }); - it('Format when time is over >99.9 years', function () { + it('Format when time is over >99.9 years', () => { assert.equal(FormatTime(3155760001, 1), 'Over 9000 days!'); }); }); }); - describe('TimeFormat = 1', function () { - before(function () { + describe('TimeFormat = 1', () => { + before(() => { CMOptions.TimeFormat = 1; }); - it('Format when time is 0', function () { + it('Format when time is 0', () => { assert.equal(FormatTime(0, 0), '00:00:00:00:00'); }); - it('Format when time is 1 second', function () { + it('Format when time is 1 second', () => { assert.equal(FormatTime(1, 0), '00:00:00:00:01'); }); - it('Format when time is over 1 minute', function () { + it('Format when time is over 1 minute', () => { assert.equal(FormatTime(61, 0), '00:00:00:01:01'); }); - it('Format when time is over 1 hour', function () { + it('Format when time is over 1 hour', () => { assert.equal(FormatTime(3601, 0), '00:00:01:00:01'); }); - it('Format when time is over 1 day', function () { + it('Format when time is over 1 day', () => { assert.equal(FormatTime(86401, 0), '00:01:00:00:01'); }); - it('Format when time is over 1 year', function () { + it('Format when time is over 1 year', () => { assert.equal(FormatTime(31536001, 0), '01:00:00:00:01'); }); - it('Format when time is over >9000 days', function () { + it('Format when time is over >9000 days', () => { assert.equal(FormatTime(777600001, 0), '24:240:00:00:01'); }); - it('Format when time is over >99.9 years', function () { + it('Format when time is over >99.9 years', () => { assert.equal(FormatTime(3155760001, 0), 'XX:XX:XX:XX:XX'); }); }); diff --git a/test/t_Disp/t_GetTimeColour.js b/test/t_Disp/t_GetTimeColour.js index 5b3ba2e..df6f999 100644 --- a/test/t_Disp/t_GetTimeColour.js +++ b/test/t_Disp/t_GetTimeColour.js @@ -4,41 +4,41 @@ import { expect } from 'chai'; import GetTimeColour from '../../src/Disp/BeautifyAndFormatting/GetTimeColour'; import { CMOptions } from '../../src/Config/VariablesAndData'; -describe('GetTimeColour', function () { - it('Format when time is less than 60', function () { +describe('GetTimeColour', () => { + it('Format when time is less than 60', () => { expect(GetTimeColour(59).color).to.deep.equal('Yellow'); }); - it('Format when time is more than 60', function () { + it('Format when time is more than 60', () => { expect(GetTimeColour(61).color).to.deep.equal('Orange'); }); - it('Format when time is more than 300', function () { + it('Format when time is more than 300', () => { expect(GetTimeColour(301).color).to.deep.equal('Red'); }); - describe('TimeFormat = 0', function () { - before(function () { + describe('TimeFormat = 0', () => { + before(() => { CMOptions.TimeFormat = 0; }); - it('Format when time is 0', function () { + it('Format when time is 0', () => { expect(GetTimeColour(0)).to.deep.equal({ text: 'Done!', color: 'Green' }); }); - it('Format when time is negative', function () { + it('Format when time is negative', () => { expect(GetTimeColour(-1)).to.deep.equal({ text: 'Done!', color: 'Green', }); }); }); - describe('TimeFormat = 1', function () { - before(function () { + describe('TimeFormat = 1', () => { + before(() => { CMOptions.TimeFormat = 1; }); - it('Format when time is 0', function () { + it('Format when time is 0', () => { expect(GetTimeColour(0)).to.deep.equal({ text: '00:00:00:00:00', color: 'Green', }); }); - it('Format when time is negative', function () { + it('Format when time is negative', () => { expect(GetTimeColour(-1)).to.deep.equal({ text: '00:00:00:00:00', color: 'Green',