diff --git a/Tests/loader.test.js b/Tests/loader.test.js
new file mode 100644
index 000000000..75159beb0
--- /dev/null
+++ b/Tests/loader.test.js
@@ -0,0 +1,14 @@
+const {JSDOM} = require('jsdom');
+
+// test for successful upload
+test('Successful upload', () => {
+ const handleUpload = jest.fn();
+ const mockFile = new File([], 'dummyFile');
+ const mockFilename = 'dummyFilename';
+
+ global.changeStatus = jest.fn();
+
+ return handleUpload(mockFile, mockFilename);
+
+ expect(global.changeStatus).toHaveBeenCalledWith('UPLOAD', 'dummyFile uploaded successfully');
+});
diff --git a/Tests/toolbar.test.js b/Tests/toolbar.test.js
new file mode 100644
index 000000000..6e37219de
--- /dev/null
+++ b/Tests/toolbar.test.js
@@ -0,0 +1,33 @@
+// test for the selected function
+const {JSDOM} = require('jsdom');
+describe('selected function', ()=>{
+ test('should add checked class to all elements until reaching an element with class "multidown"', ()=>{
+ const selected = jest.fn();
+
+ const dom = new JSDOM('
');
+ const element = dom.window.document.querySelector('li');
+ selected(element);
+
+
+ expect(element.classList.contains('checked')).toBe(false);
+ });
+});
+
+
+// test default values
+test('gets default status of form elements', () => {
+ const getStatus = jest.fn().mockReturnValue({
+ select: 'option1',
+ checkbox: false,
+ radio: 'radio1',
+ });
+
+ expect(getStatus({})).toEqual({
+ select: 'option1',
+ checkbox: false,
+ radio: 'radio1',
+ });
+});
+
+
+// test for toggle viewer mode:
diff --git a/Tests/uicallback.test.js b/Tests/uicallback.test.js
new file mode 100644
index 000000000..79c7a2df2
--- /dev/null
+++ b/Tests/uicallback.test.js
@@ -0,0 +1,139 @@
+
+
+// test for toggle viewer mode:
+
+const {JSDOM} = require('jsdom');
+const {toggleSideMenu} = require('../apps/heatmap/uicallbacks');
+
+
+// test for closeSecondary viewer
+describe('closed viewer function', () => {
+ // settting up a basic dom structure using JSDOM
+
+ const dom = new JSDOM(`
+
+
+
+
+
+
+
+ `);
+
+ // global objects for window and document
+
+ global.window = dom.window;
+ global.document = dom.window.document;
+});
+test('closeSecondaryViewer function should update classes and elements correctly', () => {
+ const closeSecondaryViewer = jest.fn();
+
+ const $CAMIC = {
+ viewer: {
+ controls: {
+ bottomright: {style: {display: ''}},
+ },
+ removeHandler: jest.fn(),
+ },
+ };
+
+ const $UI = {
+ lockerPanel: {style: {display: 'block'}},
+ toolbar: {
+ getSubTool: jest.fn(() => ({
+ querySelector: jest.fn(() => ({checked: true})),
+ })),
+ },
+ layersViewerMinor: {
+ toggleAllItems: jest.fn(),
+ setting: {data: [{layer: 'example'}]},
+ },
+ };
+
+ const Loading = {close: jest.fn()};
+
+ // Call the function
+ closeSecondaryViewer();
+
+ // Assertions
+ expect(document.getElementById('main_viewer').classList.contains('main')).toBe(true);
+ expect(document.getElementById('main_viewer').classList.contains('left')).toBe(false);
+ expect(document.getElementById('minor_viewer').classList.contains('none')).toBe(true);
+ expect(document.getElementById('minor_viewer').classList.contains('right')).toBe(false);
+ expect($CAMIC.viewer.controls.bottomright.style.display).toBe('');
+});
+
+
+const $UI = {
+ toolbar: {
+ changeMainToolStatus: jest.fn(),
+ },
+};
+ // testing the toggle side menu function
+describe('toggleSlideMenu', () => {
+ it('should changeMainToolStatus when isOpen is false', () => {
+ const opt = {
+ isOpen: false,
+ target: {id: 'sidebar_menu_1'},
+ };
+
+ const changeMainToolStatusMock = jest.fn();
+ $UI.toolbar.changeMainToolStatus = changeMainToolStatusMock;
+
+ function toggleSideMenu(options) {
+ if (!options.isOpen) {
+ $UI.toolbar.changeMainToolStatus('menu_1', false);
+ }
+ }
+
+ toggleSideMenu(opt);
+
+ expect(changeMainToolStatusMock).toHaveBeenCalledWith('menu_1', false);
+ });
+});
+
+
+// testing for the open secondary viewer
+describe('openSecondaryViewer function', () => {
+ beforeEach(() => {
+ // settting up a basic dom structure using JSDOM
+
+ const dom = new JSDOM(`
+
+
+
+
+
+
+ `);
+
+ // global objects for window and document
+
+ global.window = dom.window;
+ global.document = dom.window.document;
+ });
+
+ afterEach(() => {
+ delete global.window;
+ delete global.document;
+ });
+ test('should update classes and call multSelectorAction after timeout', () => {
+ const openSecondaryViewer = jest.fn();
+ const multSelectorAction = jest.fn();
+ // Mock necessary DOM elements
+
+
+ // Call the function
+ openSecondaryViewer();
+
+
+ // Assertions
+ const main = document.getElementById('main_viewer');
+ const minor = document.getElementById('minor_viewer');
+ expect(minor.classList.contains('none')).toBe(true);
+ expect(minor.classList.contains('right')).toBe(false);
+ // Simulate setTimeout
+ jest.runAllTimers();
+ });
+});
+