Linting in tests

This commit is contained in:
Daniël van Noord
2021-04-30 20:26:52 +02:00
parent c7a3a0a329
commit 091b1f100e
11 changed files with 125 additions and 125 deletions

View File

@@ -5,28 +5,28 @@ import { l, Game } from '../../GlobalsForTesting';
import ToggleBotBar from '../../../src/Config/Toggles/ToggleBotBar'; import ToggleBotBar from '../../../src/Config/Toggles/ToggleBotBar';
import { CMOptions } from '../../../src/Config/VariablesAndData'; import { CMOptions } from '../../../src/Config/VariablesAndData';
describe('ToggleBotBar', function () { describe('ToggleBotBar', () => {
global.l = l; global.l = l;
global.Game = Game; global.Game = Game;
beforeEach(function () { beforeEach(() => {
global.domids = {}; global.domids = {};
ToggleBotBar(); ToggleBotBar();
}); });
describe('BotBar = 0', function () { describe('BotBar = 0', () => {
before(function () { before(() => {
CMOptions.BotBar = 0; CMOptions.BotBar = 0;
}); });
it('Toggle style correctly', function () { it('Toggle style correctly', () => {
assert.equal(domids.CMBotBar.style.display, 'none'); // eslint-disable-line no-undef assert.equal(domids.CMBotBar.style.display, 'none'); // eslint-disable-line no-undef
}); });
}); });
describe('BotBar = 1', function () { describe('BotBar = 1', () => {
before(function () { before(() => {
CMOptions.BotBar = 1; CMOptions.BotBar = 1;
}); });
it('Toggle style correctly', function () { it('Toggle style correctly', () => {
assert.equal(domids.CMBotBar.style.display, ''); // eslint-disable-line no-undef assert.equal(domids.CMBotBar.style.display, ''); // eslint-disable-line no-undef
}); });
}); });

View File

@@ -6,27 +6,27 @@ import { CMOptions } from '../../../src/Config/VariablesAndData';
import ToggleDetailedTime from '../../../src/Config/Toggles/ToggleDetailedTime'; import ToggleDetailedTime from '../../../src/Config/Toggles/ToggleDetailedTime';
import { BackupFunctions } from '../../../src/Main/VariablesAndData'; import { BackupFunctions } from '../../../src/Main/VariablesAndData';
describe('ToggleDetailedTime', function () { describe('ToggleDetailedTime', () => {
global.Game = Game; global.Game = Game;
beforeEach(function () { beforeEach(() => {
ToggleDetailedTime(); ToggleDetailedTime();
}); });
describe('DetailedTime = 0', function () { describe('DetailedTime = 0', () => {
before(function () { before(() => {
CMOptions.DetailedTime = 0; CMOptions.DetailedTime = 0;
BackupFunctions.sayTime = 'BackupFunctions.sayTime'; BackupFunctions.sayTime = 'BackupFunctions.sayTime';
}); });
it('Set correct time function', function () { it('Set correct time function', () => {
assert.equal(Game.sayTime, 'BackupFunctions.sayTime'); assert.equal(Game.sayTime, 'BackupFunctions.sayTime');
}); });
}); });
describe('DetailedTime = 1', function () { describe('DetailedTime = 1', () => {
before(function () { before(() => {
CMOptions.DetailedTime = 1; CMOptions.DetailedTime = 1;
}); });
it('Set correct time function', function () { it('Set correct time function', () => {
assert.equal(Game.sayTime.name, 'CMSayTime'); assert.equal(Game.sayTime.name, 'CMSayTime');
}); });
}); });

View File

@@ -4,12 +4,12 @@ import { assert } from 'chai';
import ToggleFavouriteSetting from '../../../src/Config/Toggles/ToggleFavourites'; import ToggleFavouriteSetting from '../../../src/Config/Toggles/ToggleFavourites';
import { FavouriteSettings } from '../../../src/Disp/VariablesAndData'; import { FavouriteSettings } from '../../../src/Disp/VariablesAndData';
describe('ToggleFavouriteSetting', function () { describe('ToggleFavouriteSetting', () => {
beforeEach(function () { beforeEach(() => {
global.domids = {}; global.domids = {};
}); });
// TODO: Can't write test for checking existing config due to Babel/Typescript problem // TODO: Can't write test for checking existing config due to Babel/Typescript problem
it('New config', function () { it('New config', () => {
FavouriteSettings.push('TestConfig'); FavouriteSettings.push('TestConfig');
ToggleFavouriteSetting('TestConfig2'); ToggleFavouriteSetting('TestConfig2');
assert.deepEqual(FavouriteSettings, ['TestConfig', 'TestConfig2']); assert.deepEqual(FavouriteSettings, ['TestConfig', 'TestConfig2']);

View File

@@ -7,10 +7,10 @@ import ToggleGCTimer from '../../../src/Config/Toggles/ToggleGCTimer';
import { GCTimers } from '../../../src/Disp/VariablesAndData'; import { GCTimers } from '../../../src/Disp/VariablesAndData';
import { CacheGoldenShimmersByID } from '../../../src/Cache/VariablesAndData'; import { CacheGoldenShimmersByID } from '../../../src/Cache/VariablesAndData';
describe('ToggleGCTimer', function () { describe('ToggleGCTimer', () => {
global.l = l; global.l = l;
beforeEach(function () { beforeEach(() => {
global.domids = {}; global.domids = {};
GCTimers[0] = { style: {} }; GCTimers[0] = { style: {} };
GCTimers[1] = { style: {} }; GCTimers[1] = { style: {} };
@@ -23,20 +23,20 @@ describe('ToggleGCTimer', function () {
ToggleGCTimer(); ToggleGCTimer();
}); });
describe('GCTimer = 0', function () { describe('GCTimer = 0', () => {
before(function () { before(() => {
CMOptions.GCTimer = 0; CMOptions.GCTimer = 0;
}); });
it('Toggle style correctly', function () { it('Toggle style correctly', () => {
assert.equal(GCTimers[0].style.display, 'none'); assert.equal(GCTimers[0].style.display, 'none');
assert.equal(GCTimers[1].style.display, 'none'); assert.equal(GCTimers[1].style.display, 'none');
}); });
}); });
describe('GCTimer = 1', function () { describe('GCTimer = 1', () => {
before(function () { before(() => {
CMOptions.GCTimer = 1; CMOptions.GCTimer = 1;
}); });
it('Toggle style correctly', function () { it('Toggle style correctly', () => {
assert.equal(GCTimers[0].style.display, 'block'); assert.equal(GCTimers[0].style.display, 'block');
assert.equal(GCTimers[0].style.left, 'Test00'); assert.equal(GCTimers[0].style.left, 'Test00');
assert.equal(GCTimers[0].style.top, 'Test01'); assert.equal(GCTimers[0].style.top, 'Test01');

View File

@@ -5,27 +5,27 @@ import { l } from '../../GlobalsForTesting';
import { CMOptions } from '../../../src/Config/VariablesAndData'; import { CMOptions } from '../../../src/Config/VariablesAndData';
import ToggleSectionHideButtons from '../../../src/Config/Toggles/ToggleSectionHideButtons'; import ToggleSectionHideButtons from '../../../src/Config/Toggles/ToggleSectionHideButtons';
describe('ToggleSectionHideButtons', function () { describe('ToggleSectionHideButtons', () => {
global.l = l; global.l = l;
beforeEach(function () { beforeEach(() => {
global.domids = {}; global.domids = {};
ToggleSectionHideButtons(); ToggleSectionHideButtons();
}); });
describe('HideSectionsButtons = 0', function () { describe('HideSectionsButtons = 0', () => {
before(function () { before(() => {
CMOptions.HideSectionsButtons = 0; CMOptions.HideSectionsButtons = 0;
}); });
it('Toggle style correctly', function () { it('Toggle style correctly', () => {
assert.equal(domids.CMSectionHidButtons.style.display, 'none'); // eslint-disable-line no-undef assert.equal(domids.CMSectionHidButtons.style.display, 'none'); // eslint-disable-line no-undef
}); });
}); });
describe('HideSectionsButtons = 1', function () { describe('HideSectionsButtons = 1', () => {
before(function () { before(() => {
CMOptions.HideSectionsButtons = 1; CMOptions.HideSectionsButtons = 1;
}); });
it('Toggle style correctly', function () { it('Toggle style correctly', () => {
assert.equal(domids.CMSectionHidButtons.style.display, ''); // eslint-disable-line no-undef assert.equal(domids.CMSectionHidButtons.style.display, ''); // eslint-disable-line no-undef
}); });
}); });

View File

@@ -5,29 +5,29 @@ import { l } from '../../GlobalsForTesting';
import { CMOptions } from '../../../src/Config/VariablesAndData'; import { CMOptions } from '../../../src/Config/VariablesAndData';
import ToggleToolWarnPos from '../../../src/Config/Toggles/ToggleToolWarnPos'; import ToggleToolWarnPos from '../../../src/Config/Toggles/ToggleToolWarnPos';
describe('ToggleToolWarnPos', function () { describe('ToggleToolWarnPos', () => {
global.l = l; global.l = l;
beforeEach(function () { beforeEach(() => {
global.domids = {}; global.domids = {};
ToggleToolWarnPos(); ToggleToolWarnPos();
}); });
describe('ToolWarnPos = 0', function () { describe('ToolWarnPos = 0', () => {
before(function () { before(() => {
CMOptions.ToolWarnPos = 0; 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.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.margin, '4px -4px'); // eslint-disable-line no-undef
assert.equal(domids.CMDispTooltipWarningParent.style.padding, '3px 4px'); // eslint-disable-line no-undef assert.equal(domids.CMDispTooltipWarningParent.style.padding, '3px 4px'); // eslint-disable-line no-undef
}); });
}); });
describe('ToolWarnPos = 1', function () { describe('ToolWarnPos = 1', () => {
before(function () { before(() => {
CMOptions.ToolWarnPos = 1; 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.right, 'auto'); // eslint-disable-line no-undef
assert.equal(domids.CMDispTooltipWarningParent.style.margin, '4px'); // 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 assert.equal(domids.CMDispTooltipWarningParent.style.padding, '4px 3px'); // eslint-disable-line no-undef

View File

@@ -5,36 +5,36 @@ import { l, Game } from '../../GlobalsForTesting';
import { CMOptions } from '../../../src/Config/VariablesAndData'; import { CMOptions } from '../../../src/Config/VariablesAndData';
import ToggleUpgradeBarAndColor from '../../../src/Config/Toggles/ToggleUpgradeBarAndColour'; import ToggleUpgradeBarAndColor from '../../../src/Config/Toggles/ToggleUpgradeBarAndColour';
describe('ToggleUpgradeBarAndColor', function () { describe('ToggleUpgradeBarAndColor', () => {
global.l = l; global.l = l;
global.Game = Game; global.Game = Game;
beforeEach(function () { beforeEach(() => {
global.domids = {}; global.domids = {};
ToggleUpgradeBarAndColor(); ToggleUpgradeBarAndColor();
}); });
describe('UpBarColor = 0', function () { describe('UpBarColor = 0', () => {
before(function () { before(() => {
CMOptions.UpBarColor = 0; CMOptions.UpBarColor = 0;
}); });
it('Toggle style correctly', function () { it('Toggle style correctly', () => {
assert.equal(domids.CMUpgradeBar.style.display, 'none'); // eslint-disable-line no-undef assert.equal(domids.CMUpgradeBar.style.display, 'none'); // eslint-disable-line no-undef
}); });
}); });
describe('UpBarColor = 1', function () { describe('UpBarColor = 1', () => {
before(function () { before(() => {
CMOptions.UpBarColor = 1; CMOptions.UpBarColor = 1;
}); });
it('Toggle style correctly', function () { it('Toggle style correctly', () => {
assert.equal(domids.CMUpgradeBar.style.display, ''); // eslint-disable-line no-undef assert.equal(domids.CMUpgradeBar.style.display, ''); // eslint-disable-line no-undef
}); });
}); });
describe('UpBarColor = 2', function () { describe('UpBarColor = 2', () => {
before(function () { before(() => {
CMOptions.UpBarColor = 2; CMOptions.UpBarColor = 2;
}); });
it('Toggle style correctly', function () { it('Toggle style correctly', () => {
assert.equal(domids.CMUpgradeBar.style.display, 'none'); // eslint-disable-line no-undef assert.equal(domids.CMUpgradeBar.style.display, 'none'); // eslint-disable-line no-undef
}); });
}); });

View File

@@ -5,27 +5,27 @@ import { l } from '../../GlobalsForTesting';
import { CMOptions } from '../../../src/Config/VariablesAndData'; import { CMOptions } from '../../../src/Config/VariablesAndData';
import ToggleUpgradeBarFixedPos from '../../../src/Config/Toggles/ToggleUpgradeBarFixedPos'; import ToggleUpgradeBarFixedPos from '../../../src/Config/Toggles/ToggleUpgradeBarFixedPos';
describe('ToggleUpgradeBarFixedPos', function () { describe('ToggleUpgradeBarFixedPos', () => {
global.l = l; global.l = l;
beforeEach(function () { beforeEach(() => {
global.domids = {}; global.domids = {};
ToggleUpgradeBarFixedPos(); ToggleUpgradeBarFixedPos();
}); });
describe('UpgradeBarFixedPos = 0', function () { describe('UpgradeBarFixedPos = 0', () => {
before(function () { before(() => {
CMOptions.UpgradeBarFixedPos = 0; CMOptions.UpgradeBarFixedPos = 0;
}); });
it('Toggle style correctly', function () { it('Toggle style correctly', () => {
assert.equal(domids.CMUpgradeBar.style.position, ''); // eslint-disable-line no-undef assert.equal(domids.CMUpgradeBar.style.position, ''); // eslint-disable-line no-undef
}); });
}); });
describe('UpgradeBarFixedPos = 1', function () { describe('UpgradeBarFixedPos = 1', () => {
before(function () { before(() => {
CMOptions.UpgradeBarFixedPos = 1; 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.position, 'sticky'); // eslint-disable-line no-undef
assert.equal(domids.CMUpgradeBar.style.top, '0px'); // eslint-disable-line no-undef assert.equal(domids.CMUpgradeBar.style.top, '0px'); // eslint-disable-line no-undef
}); });

View File

@@ -5,56 +5,56 @@ import { l, Game } from '../../GlobalsForTesting';
import { CMOptions } from '../../../src/Config/VariablesAndData'; import { CMOptions } from '../../../src/Config/VariablesAndData';
import ToggleWrinklerButtons from '../../../src/Config/Toggles/ToggleWrinklerButtons'; import ToggleWrinklerButtons from '../../../src/Config/Toggles/ToggleWrinklerButtons';
describe('ToggleWrinklerButtons', function () { describe('ToggleWrinklerButtons', () => {
global.l = l; global.l = l;
global.Game = Game; global.Game = Game;
beforeEach(function () { beforeEach(() => {
global.domids = {}; global.domids = {};
ToggleWrinklerButtons(); ToggleWrinklerButtons();
}); });
describe('WrinklerButtons = 0', function () { describe('WrinklerButtons = 0', () => {
before(function () { before(() => {
CMOptions.WrinklerButtons = 0; CMOptions.WrinklerButtons = 0;
}); });
describe('Game.elderWrath = 0', function () { describe('Game.elderWrath = 0', () => {
before(function () { before(() => {
Game.elderWrath = 0; 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.PopAllNormalWrinklerButton.style.display, 'none'); // eslint-disable-line no-undef
assert.equal(domids.PopFattestWrinklerButton.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 () { describe('Game.elderWrath = 1', () => {
before(function () { before(() => {
Game.elderWrath = 1; 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.PopAllNormalWrinklerButton.style.display, 'none'); // eslint-disable-line no-undef
assert.equal(domids.PopFattestWrinklerButton.style.display, 'none'); // eslint-disable-line no-undef assert.equal(domids.PopFattestWrinklerButton.style.display, 'none'); // eslint-disable-line no-undef
}); });
}); });
}); });
describe('WrinklerButtons = 1', function () { describe('WrinklerButtons = 1', () => {
before(function () { before(() => {
CMOptions.WrinklerButtons = 1; CMOptions.WrinklerButtons = 1;
}); });
describe('Game.elderWrath = 0', function () { describe('Game.elderWrath = 0', () => {
before(function () { before(() => {
Game.elderWrath = 0; 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.PopAllNormalWrinklerButton.style.display, 'none'); // eslint-disable-line no-undef
assert.equal(domids.PopFattestWrinklerButton.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 () { describe('Game.elderWrath = 1', () => {
before(function () { before(() => {
Game.elderWrath = 1; 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.PopAllNormalWrinklerButton.style.display, ''); // eslint-disable-line no-undef
assert.equal(domids.PopFattestWrinklerButton.style.display, ''); // eslint-disable-line no-undef assert.equal(domids.PopFattestWrinklerButton.style.display, ''); // eslint-disable-line no-undef
}); });

View File

@@ -4,102 +4,102 @@ import { assert } from 'chai';
import FormatTime from '../../src/Disp/BeautifyAndFormatting/FormatTime'; import FormatTime from '../../src/Disp/BeautifyAndFormatting/FormatTime';
import { CMOptions } from '../../src/Config/VariablesAndData'; import { CMOptions } from '../../src/Config/VariablesAndData';
describe('FormatTime', function () { describe('FormatTime', () => {
it('Format when time is Infinity', function () { it('Format when time is Infinity', () => {
assert.equal(FormatTime(Infinity, 0), 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'); assert.equal(FormatTime(-1, 0), 'Negative time period');
}); });
describe('TimeFormat = 0', function () { describe('TimeFormat = 0', () => {
before(function () { before(() => {
CMOptions.TimeFormat = 0; CMOptions.TimeFormat = 0;
}); });
describe('Longformat = 0', function () { describe('Longformat = 0', () => {
it('Format when time is 0', function () { it('Format when time is 0', () => {
assert.equal(FormatTime(0, 0), '0s'); 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'); 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'); 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'); 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'); 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'); 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'); 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'); assert.equal(FormatTime(3155760001, 0), '>9000d');
}); });
}); });
describe('Longformat = 1', function () { describe('Longformat = 1', () => {
it('Format when time is 0', function () { it('Format when time is 0', () => {
assert.equal(FormatTime(0, 1), '0 seconds'); 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'); 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'); 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'); 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( assert.equal(
FormatTime(86401, 1), FormatTime(86401, 1),
'1 day, 0 hours, 0 minutes, 1 second', '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( assert.equal(
FormatTime(31536001, 1), FormatTime(31536001, 1),
'1 year, 0 days, 0 hours, 0 minutes, 1 second', '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!'); 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!'); assert.equal(FormatTime(3155760001, 1), 'Over 9000 days!');
}); });
}); });
}); });
describe('TimeFormat = 1', function () { describe('TimeFormat = 1', () => {
before(function () { before(() => {
CMOptions.TimeFormat = 1; 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'); 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'); 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'); 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'); 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'); 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'); 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'); 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'); assert.equal(FormatTime(3155760001, 0), 'XX:XX:XX:XX:XX');
}); });
}); });

View File

@@ -4,41 +4,41 @@ import { expect } from 'chai';
import GetTimeColour from '../../src/Disp/BeautifyAndFormatting/GetTimeColour'; import GetTimeColour from '../../src/Disp/BeautifyAndFormatting/GetTimeColour';
import { CMOptions } from '../../src/Config/VariablesAndData'; import { CMOptions } from '../../src/Config/VariablesAndData';
describe('GetTimeColour', function () { describe('GetTimeColour', () => {
it('Format when time is less than 60', function () { it('Format when time is less than 60', () => {
expect(GetTimeColour(59).color).to.deep.equal('Yellow'); 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'); 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'); expect(GetTimeColour(301).color).to.deep.equal('Red');
}); });
describe('TimeFormat = 0', function () { describe('TimeFormat = 0', () => {
before(function () { before(() => {
CMOptions.TimeFormat = 0; 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' }); 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({ expect(GetTimeColour(-1)).to.deep.equal({
text: 'Done!', text: 'Done!',
color: 'Green', color: 'Green',
}); });
}); });
}); });
describe('TimeFormat = 1', function () { describe('TimeFormat = 1', () => {
before(function () { before(() => {
CMOptions.TimeFormat = 1; CMOptions.TimeFormat = 1;
}); });
it('Format when time is 0', function () { it('Format when time is 0', () => {
expect(GetTimeColour(0)).to.deep.equal({ expect(GetTimeColour(0)).to.deep.equal({
text: '00:00:00:00:00', text: '00:00:00:00:00',
color: 'Green', color: 'Green',
}); });
}); });
it('Format when time is negative', function () { it('Format when time is negative', () => {
expect(GetTimeColour(-1)).to.deep.equal({ expect(GetTimeColour(-1)).to.deep.equal({
text: '00:00:00:00:00', text: '00:00:00:00:00',
color: 'Green', color: 'Green',