Added tests for Toggles

This commit is contained in:
Daniël van Noord
2021-04-13 15:59:37 +02:00
parent d23719c2a8
commit e4cdc6b85a
16 changed files with 309 additions and 160 deletions

View File

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