Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/react-virtualized/dist/commonjs/Collection/ drwxr-xr-x | |
| Viewing file: Select action/file-type: "use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _SectionManager = _interopRequireDefault(require("./SectionManager"));
var _TestData = require("./TestData");
function initSectionManager() {
var sectionManager = new _SectionManager["default"](_TestData.SECTION_SIZE);
_TestData.CELLS.forEach(function (cellMetadatum, index) {
sectionManager.registerCell({
cellMetadatum: cellMetadatum,
index: index
});
});
return sectionManager;
}
function verifySections(sectionManager, sizeAndPosition, expectedSizeAndPositionInfos) {
var sections = sectionManager.getSections(sizeAndPosition);
expect(sections.length).toEqual(expectedSizeAndPositionInfos.length);
expectedSizeAndPositionInfos.forEach(function (sizeAndPosition) {
var match = sections.find(function (section) {
return section.x === sizeAndPosition.x && section.y === sizeAndPosition.y;
});
expect(!!match).toEqual(true);
});
}
describe('SectionManager', function () {
it('creates the appropriate number of Sections', function () {
var sectionManager = initSectionManager();
expect(sectionManager.getTotalSectionCount()).toEqual(6);
});
it('returns the proper Sections based on the specified area', function () {
var sectionManager = initSectionManager();
verifySections(sectionManager, {
x: 0,
y: 0,
width: 1,
height: 1
}, [{
x: 0,
y: 0
}]);
verifySections(sectionManager, {
x: 1,
y: 1,
width: 1,
height: 1
}, [{
x: 0,
y: 0
}]);
verifySections(sectionManager, {
x: 0,
y: 0,
width: 4,
height: 4
}, [{
x: 0,
y: 0
}, {
x: 2,
y: 0
}, {
x: 0,
y: 2
}, {
x: 2,
y: 2
}]);
verifySections(sectionManager, {
x: 4,
y: 0,
width: 2,
height: 3
}, [{
x: 4,
y: 0
}, {
x: 4,
y: 2
}]);
});
it('assigns cells to the appropriate sections', function () {
var sectionManager = initSectionManager();
expect(sectionManager.getCellIndices({
x: 0,
y: 0,
width: 2,
height: 2
})).toEqual([0]);
expect(sectionManager.getCellIndices({
x: 2,
y: 0,
width: 2,
height: 2
})).toEqual([1, 2, 3]);
expect(sectionManager.getCellIndices({
x: 4,
y: 0,
width: 2,
height: 2
})).toEqual([6]);
expect(sectionManager.getCellIndices({
x: 0,
y: 2,
width: 2,
height: 2
})).toEqual([4]);
expect(sectionManager.getCellIndices({
x: 2,
y: 2,
width: 2,
height: 2
})).toEqual([3, 4, 5]);
expect(sectionManager.getCellIndices({
x: 4,
y: 2,
width: 2,
height: 2
})).toEqual([7, 8, 9]);
});
}); |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.005 ]-- |