diff --git a/src/main/zapHomeFiles/hud/utils.js b/src/main/zapHomeFiles/hud/utils.js index 2e5e69510..257bc4067 100644 --- a/src/main/zapHomeFiles/hud/utils.js +++ b/src/main/zapHomeFiles/hud/utils.js @@ -733,7 +733,40 @@ const utils = (function () { const dateObject = new Date(Number(timestamp)); return dateObject.toISOString().slice(11, 23); } - + module.exports= { + parseRequestHeader, + parseResponseHeader, + isFromTrustedOrigin, + parseDomainFromUrl, + getParameter, + isHUDInitialized, + initializeHUD, + loadFrame, + saveFrame, + registerTool, + registerTools, + loadTool, + writeTool, + loadPanelTools, + loadAllTools, + addToolToPanel, + removeToolFromPanel, + messageFrame, + messageAllTabs, + getAllClients, + getWindowVisibilityState, + messageWindow, + sortToolsByPosition, + configureButtonHtml, + getUpgradedDomain, + getUpgradedUrl, + errorHandler, + getZapFilePath, + getZapImagePath, + zapApiErrorDialog, + log, + timestampToTimeString + }; return { parseRequestHeader, parseResponseHeader, @@ -768,4 +801,6 @@ const utils = (function () { log, timestampToTimeString }; + + })(); diff --git a/src/test/js/utils.test.js b/src/test/js/utils.test.js index 444e20a84..d91a8a5a3 100644 --- a/src/test/js/utils.test.js +++ b/src/test/js/utils.test.js @@ -1,15 +1,15 @@ const test = require('ava'); +const utils = require('../../../src/main/zapHomeFiles/hud/utils.js'); // TODO: use clean build system // Dynamically load utils functions from utils.js // -const fs = require('fs'); +// const fs = require('fs'); -const CODE_PATH = './src/main/zapHomeFiles/hud/utils.js'; -const jsCode = fs.readFileSync(CODE_PATH, 'utf-8'); -global.eval(jsCode); +// const CODE_PATH = './src/main/zapHomeFiles/hud/utils.js'; +// const jsCode = fs.readFileSync(CODE_PATH, 'utf-8'); +// global.eval(jsCode); // - test('sortToolsByPosition result are in descending order', t => { const tools = [{ position: 3,