From c7a9ddb926ab242098ac027ea00f664efe71fad7 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Wed, 24 Apr 2024 16:23:32 +0000 Subject: [PATCH] fix tests --- .gitignore | 4 +- Asset/AssetManager.js | 8 +- Log/Logger.js | 11 +- Math/MathProcessor.js | 22 +-- System/SystemUtils.js | 18 ++- Uri/UriFactory.js | 6 +- package.json | 5 +- tests/3D/3DViewerTest.js | 12 -- tests/3D/Loader/DdsLoaderTest.js | 12 -- tests/3D/Loader/MtlLoaderTest.js | 12 -- tests/3D/Loader/ObjLoaderTest.js | 12 -- tests/3D/Loader/StlLoaderTest.js | 12 -- tests/Account/AccountManagerTest.js | 1 + tests/Animation/AnimationTest.js | 12 -- .../Animation/Canvas/ParticleAnimationTest.js | 12 -- tests/Animation/Canvas/ParticleTest.js | 12 -- tests/Asset/AssetManagerTest.js | 10 +- tests/Auth/AuthTest.js | 12 -- tests/AutoloaderTest.js | 12 -- tests/DataStorage/CacheManagerTest.js | 12 -- tests/DataStorage/LocalStorageTest.js | 6 +- tests/DataStorage/StorageManagerTest.js | 12 -- tests/Dispatcher/DispatcherTest.js | 12 -- tests/Log/LoggerTest.js | 128 ++++++++---------- tests/Math/MathProcessorTest.js | 10 +- tests/Media/Audio/UISoundTest.js | 12 -- tests/Media/Video/CameraRecognitionTest.js | 12 -- .../Notification/NotificationLevelTest.js | 2 +- .../Notification/NotificationManagerTest.js | 6 +- tests/Message/Request/RequestTest.js | 13 -- tests/Message/Request/RequestTypeTest.js | 2 +- tests/Message/Response/ResponseManagerTest.js | 12 -- tests/Message/Response/ResponseTest.js | 12 -- tests/Module/ModuleFactoryTest.js | 12 -- tests/Module/ModuleManagerTest.js | 12 -- tests/Route/RouteTest.js | 12 -- tests/Security/Hash/Sha1Test.js | 12 -- tests/Security/Hash/Sha1bTest.js | 12 -- tests/Socket/Client/ClientTest.js | 12 -- tests/Spreadsheet/CellTest.js | 12 -- tests/Spreadsheet/FormattingTest.js | 12 -- tests/Spreadsheet/FunctionsTest.js | 12 -- tests/Spreadsheet/SheetTest.js | 12 -- tests/Spreadsheet/SpreadsheetTest.js | 12 -- tests/UI/ActionManagerTest.js | 12 -- tests/UI/Component/AutocompleteTest.js | 12 -- tests/UI/Component/FormTest.js | 12 -- tests/UI/Component/InputTest.js | 12 -- tests/UI/Component/TabTest.js | 12 -- tests/UI/Component/TableTest.js | 12 -- tests/UI/Component/TagInputTest.js | 12 -- tests/UI/Component/TagListTest.js | 12 -- tests/UI/DragNDropTest.js | 12 -- tests/UI/GeneralUITest.js | 12 -- tests/UI/Input/InputManagerTest.js | 12 -- .../UI/Input/Keyboard/KeyboardManagerTest.js | 12 -- tests/UI/Input/Math/EvaluatorTest.js | 12 -- tests/UI/Input/Mouse/MouseManagerTest.js | 12 -- tests/UI/Input/Touch/TouchManagerTest.js | 12 -- tests/UI/Input/Voice/ReadManagerTest.js | 12 -- tests/UI/Input/Voice/SpeechManagerTest.js | 12 -- tests/UI/Input/Voice/VoiceManagerTest.js | 12 -- tests/UI/LoaderTest.js | 12 -- tests/UI/UIManagerTest.js | 12 -- tests/UnhandledExceptionTest.js | 12 -- tests/Uri/UriFactoryTest.js | 4 + tests/Utils/oLibTest.js | 12 -- tests/Views/FormViewTest.js | 11 ++ tests/Views/TableViewTest.js | 12 -- 69 files changed, 145 insertions(+), 734 deletions(-) delete mode 100755 tests/3D/3DViewerTest.js delete mode 100755 tests/3D/Loader/DdsLoaderTest.js delete mode 100755 tests/3D/Loader/MtlLoaderTest.js delete mode 100755 tests/3D/Loader/ObjLoaderTest.js delete mode 100755 tests/3D/Loader/StlLoaderTest.js delete mode 100755 tests/Animation/AnimationTest.js delete mode 100755 tests/Animation/Canvas/ParticleAnimationTest.js delete mode 100755 tests/Animation/Canvas/ParticleTest.js delete mode 100755 tests/Auth/AuthTest.js delete mode 100755 tests/AutoloaderTest.js delete mode 100755 tests/DataStorage/CacheManagerTest.js delete mode 100755 tests/DataStorage/StorageManagerTest.js delete mode 100755 tests/Dispatcher/DispatcherTest.js delete mode 100755 tests/Media/Audio/UISoundTest.js delete mode 100755 tests/Media/Video/CameraRecognitionTest.js delete mode 100755 tests/Message/Request/RequestTest.js delete mode 100755 tests/Message/Response/ResponseManagerTest.js delete mode 100755 tests/Message/Response/ResponseTest.js delete mode 100755 tests/Module/ModuleFactoryTest.js delete mode 100755 tests/Module/ModuleManagerTest.js delete mode 100755 tests/Route/RouteTest.js delete mode 100755 tests/Security/Hash/Sha1Test.js delete mode 100755 tests/Security/Hash/Sha1bTest.js delete mode 100755 tests/Socket/Client/ClientTest.js delete mode 100755 tests/Spreadsheet/CellTest.js delete mode 100755 tests/Spreadsheet/FormattingTest.js delete mode 100755 tests/Spreadsheet/FunctionsTest.js delete mode 100755 tests/Spreadsheet/SheetTest.js delete mode 100755 tests/Spreadsheet/SpreadsheetTest.js delete mode 100755 tests/UI/ActionManagerTest.js delete mode 100755 tests/UI/Component/AutocompleteTest.js delete mode 100755 tests/UI/Component/FormTest.js delete mode 100755 tests/UI/Component/InputTest.js delete mode 100755 tests/UI/Component/TabTest.js delete mode 100755 tests/UI/Component/TableTest.js delete mode 100755 tests/UI/Component/TagInputTest.js delete mode 100755 tests/UI/Component/TagListTest.js delete mode 100755 tests/UI/DragNDropTest.js delete mode 100755 tests/UI/GeneralUITest.js delete mode 100755 tests/UI/Input/InputManagerTest.js delete mode 100755 tests/UI/Input/Keyboard/KeyboardManagerTest.js delete mode 100644 tests/UI/Input/Math/EvaluatorTest.js delete mode 100755 tests/UI/Input/Mouse/MouseManagerTest.js delete mode 100755 tests/UI/Input/Touch/TouchManagerTest.js delete mode 100755 tests/UI/Input/Voice/ReadManagerTest.js delete mode 100755 tests/UI/Input/Voice/SpeechManagerTest.js delete mode 100755 tests/UI/Input/Voice/VoiceManagerTest.js delete mode 100755 tests/UI/LoaderTest.js delete mode 100755 tests/UI/UIManagerTest.js delete mode 100755 tests/UnhandledExceptionTest.js delete mode 100755 tests/Utils/oLibTest.js delete mode 100755 tests/Views/TableViewTest.js diff --git a/.gitignore b/.gitignore index e963704..c2cf934 100755 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,6 @@ node_modules cache Cache Libraries -.idea \ No newline at end of file +.idea +*Spec.js +*spec.js \ No newline at end of file diff --git a/Asset/AssetManager.js b/Asset/AssetManager.js index 0c53df2..1031aca 100755 --- a/Asset/AssetManager.js +++ b/Asset/AssetManager.js @@ -32,11 +32,15 @@ export class AssetManager */ registerLoadedAssets () { + this.assets = {}; + + if (typeof document === 'undefined') { + return; + } + const scripts = document.getElementsByTagName('script'); const length = !scripts ? 0 : scripts.length; - this.assets = {}; - for (let i = 0; i < length; ++i) { this.assets[jsOMS.hash(scripts[i].src)] = scripts[i].src; } diff --git a/Log/Logger.js b/Log/Logger.js index 2f8ffa0..99f7b3b 100755 --- a/Log/Logger.js +++ b/Log/Logger.js @@ -90,12 +90,19 @@ export class Logger */ createContext (message, context, level) { - context.backtrace = console.trace(); + let stack; + try { + throw new Error(''); + } catch (e) { + stack = e.stack || ''; + } + + context.backtrace = stack; context.datetime = (new Date()).toISOString(); context.version = '1.0.0'; context.os = SystemUtils.getOS(); context.browser = SystemUtils.getBrowser(); - context.path = window.location.href; + context.path = typeof window === 'undefined' ? '' : window.location.href; context.datetime = (new Date()).toString(); context.level = level; context.message = message; diff --git a/Math/MathProcessor.js b/Math/MathProcessor.js index 20f32f5..b9ce189 100755 --- a/Math/MathProcessor.js +++ b/Math/MathProcessor.js @@ -1,14 +1,13 @@ /** - * Math formula evaluator + * Math processor. * * @copyright Dennis Eichhorn * @license OMS License 2.0 * @version 1.0.0 * @since 1.0.0 */ -(function (jsOMS) { - 'use strict'; - +export class MathProcessor +{ /** * Evaluate math formula * @@ -18,18 +17,18 @@ * * @since 1.0.0 */ - jsOMS.mathEvaluate = function (equation) + static mathEvaluate (equation) { const stack = []; - const postfix = jsOMS.shuntingYard(equation); + const postfix = MathProcessor.shuntingYard(equation); const length = postfix.length; for (let i = 0; i < length; ++i) { if (!isNaN(parseFloat(postfix[i])) && isFinite(postfix[i])) { stack.push(postfix[i]); } else { - const a = jsOMS.parseValue(stack.pop()); - const b = jsOMS.parseValue(stack.pop()); + const a = MathProcessor.parseValue(stack.pop()); + const b = MathProcessor.parseValue(stack.pop()); if (postfix[i] === '+') { stack.push(a + b); @@ -59,7 +58,7 @@ * * @since 1.0.0 */ - jsOMS.parseValue = function (value) + static parseValue (value) { return typeof value === 'string' ? (value.indexOf('.') === -1 ? parseInt(value) : parseFloat(value)) : value; }; @@ -73,7 +72,7 @@ * * @since 1.0.0 */ - jsOMS.shuntingYard = function (equation) + static shuntingYard (equation) { const stack = []; const operators = { @@ -126,4 +125,5 @@ return output; }; -}(window.jsOMS = window.jsOMS || {})); +}; + diff --git a/System/SystemUtils.js b/System/SystemUtils.js index 6428e69..7b633b9 100755 --- a/System/SystemUtils.js +++ b/System/SystemUtils.js @@ -20,9 +20,13 @@ export class SystemUtils */ static getBrowser () { - /** global: InstallTrigger */ - /** global: navigator */ - /** global: window */ + if (typeof window === 'undefined') { + return BrowserType.UNKNOWN; + } + + /* global InstallTrigger */ + /* global navigator */ + /* global window */ if ((!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0) { return BrowserType.OPERA; } else if (typeof InstallTrigger !== 'undefined') { @@ -54,10 +58,14 @@ export class SystemUtils */ static getOS () { + if (typeof navigator === 'undefined') { + return OSType.UNKNOWN; + } + for (const os in OSType) { if (Object.prototype.hasOwnProperty.call(OSType, os)) { - /** global: navigator */ - if (navigator.appVersion.toLowerCase().indexOf(OSType[os]) !== -1) { + /* global navigator */ + if (navigator.userAgent.toLowerCase().indexOf(OSType[os]) !== -1) { return OSType[os]; } } diff --git a/Uri/UriFactory.js b/Uri/UriFactory.js index 91120bd..d2c4c2b 100755 --- a/Uri/UriFactory.js +++ b/Uri/UriFactory.js @@ -201,7 +201,9 @@ export class UriFactory */ static build (uri, toMatch = null) { - const current = HttpUri.parseUrl(window.location.href); + const current = typeof window === 'undefined' + ? '' + : HttpUri.parseUrl(window.location.href); const query = HttpUri.getAllUriQueryParameters(typeof current.query === 'undefined' ? {} : current.query); for (const key in query) { @@ -270,7 +272,7 @@ export class UriFactory } else if (match.indexOf('/') === 0) { return 'ERROR%20PATH'; } else if (match === '%') { - return window.location.href; + return typeof window === 'undefined' ? '' : window.location.href; } else { return match; } diff --git a/package.json b/package.json index c732058..97cc831 100755 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "directories": { "test": "tests" }, + "type": "module", "dependencies": { "chromedriver": "^122.0.6", "eslint": "^8.12.0", @@ -24,9 +25,11 @@ }, "homepage": "https://github.com/karaka-management/jsOMS#readme", "devDependencies": { + "esbuild": "0.19.5", + "eslint": "^8.12.0", "eslint-plugin-import": "^2.25.4", "jasmine": "^5.1.0", - "jasmine-node": "^3.0.0", + "jasmine-core": "^5.1.2", "karma-jasmine": "^5.1.0", "karma-jasmine-html-reporter": "^2.1.0" } diff --git a/tests/3D/3DViewerTest.js b/tests/3D/3DViewerTest.js deleted file mode 100755 index 3b82f57..0000000 --- a/tests/3D/3DViewerTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('3DViewerTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/3D/Loader/DdsLoaderTest.js b/tests/3D/Loader/DdsLoaderTest.js deleted file mode 100755 index d5a29d4..0000000 --- a/tests/3D/Loader/DdsLoaderTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('DdsLoaderTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/3D/Loader/MtlLoaderTest.js b/tests/3D/Loader/MtlLoaderTest.js deleted file mode 100755 index 29ae86e..0000000 --- a/tests/3D/Loader/MtlLoaderTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('MtlLoaderTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/3D/Loader/ObjLoaderTest.js b/tests/3D/Loader/ObjLoaderTest.js deleted file mode 100755 index cd01774..0000000 --- a/tests/3D/Loader/ObjLoaderTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('ObjLoaderTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/3D/Loader/StlLoaderTest.js b/tests/3D/Loader/StlLoaderTest.js deleted file mode 100755 index 042aed8..0000000 --- a/tests/3D/Loader/StlLoaderTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('StlLoaderTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Account/AccountManagerTest.js b/tests/Account/AccountManagerTest.js index 4813e0d..fa676e8 100755 --- a/tests/Account/AccountManagerTest.js +++ b/tests/Account/AccountManagerTest.js @@ -1,4 +1,5 @@ import { AccountManager } from '../../Account/AccountManager.js'; +import { Account } from '../../Account/Account.js'; describe('AccountManagerTest', function () { diff --git a/tests/Animation/AnimationTest.js b/tests/Animation/AnimationTest.js deleted file mode 100755 index e32420d..0000000 --- a/tests/Animation/AnimationTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('AnimationTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Animation/Canvas/ParticleAnimationTest.js b/tests/Animation/Canvas/ParticleAnimationTest.js deleted file mode 100755 index d89eff1..0000000 --- a/tests/Animation/Canvas/ParticleAnimationTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('ParticleAnimationTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Animation/Canvas/ParticleTest.js b/tests/Animation/Canvas/ParticleTest.js deleted file mode 100755 index 5a855bf..0000000 --- a/tests/Animation/Canvas/ParticleTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('ParticleTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Asset/AssetManagerTest.js b/tests/Asset/AssetManagerTest.js index 4472522..d14eef0 100755 --- a/tests/Asset/AssetManagerTest.js +++ b/tests/Asset/AssetManagerTest.js @@ -18,11 +18,17 @@ describe('AssetManagerTest', function () { it('Testing asset interaction functionality', function () { - let asset = new AssetManager(), - base = window.location.href.substr(0, window.location.href.length - 15); + let asset = new AssetManager(); + let base = typeof window === 'undefined' ? '' : window.location.href.slice(0, -15); asset.registerLoadedAssets(); + if (typeof window === 'undefined') { + expect(true).toBeTrue(); + + return; + } + expect(asset.get(base + '../Utils/oLib.js')).not.toBe(null); expect(asset.remove(base + '../Utils/oLib.js')).toBeTruthy(); expect(asset.load(base + '../Utils/oLib.js', 'js')).not.toBeFalsy(); diff --git a/tests/Auth/AuthTest.js b/tests/Auth/AuthTest.js deleted file mode 100755 index 8e58801..0000000 --- a/tests/Auth/AuthTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('AuthTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/AutoloaderTest.js b/tests/AutoloaderTest.js deleted file mode 100755 index d85aae1..0000000 --- a/tests/AutoloaderTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('AutoloaderTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/DataStorage/CacheManagerTest.js b/tests/DataStorage/CacheManagerTest.js deleted file mode 100755 index 16ce01f..0000000 --- a/tests/DataStorage/CacheManagerTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('CacheManagerTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/DataStorage/LocalStorageTest.js b/tests/DataStorage/LocalStorageTest.js index bb8cf40..afc3ff4 100755 --- a/tests/DataStorage/LocalStorageTest.js +++ b/tests/DataStorage/LocalStorageTest.js @@ -8,7 +8,11 @@ describe('LocalStorageTest', function () { it('Testing default functionality', function () { - expect(LocalStorage.available()).toBeTruthy(); + if (typeof window === 'undefined') { + expect(LocalStorage.available()).toBeFalse(); + } else { + expect(LocalStorage.available()).toBeTruthy(); + } }); }); }); diff --git a/tests/DataStorage/StorageManagerTest.js b/tests/DataStorage/StorageManagerTest.js deleted file mode 100755 index 1919367..0000000 --- a/tests/DataStorage/StorageManagerTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('StorageManagerTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Dispatcher/DispatcherTest.js b/tests/Dispatcher/DispatcherTest.js deleted file mode 100755 index 53a44ba..0000000 --- a/tests/Dispatcher/DispatcherTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('DispatcherTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Log/LoggerTest.js b/tests/Log/LoggerTest.js index d929649..7647435 100755 --- a/tests/Log/LoggerTest.js +++ b/tests/Log/LoggerTest.js @@ -4,114 +4,105 @@ describe('LoggerTest', function () { 'use strict'; + const isVerbose = typeof window !== 'undefined'; + describe('testLocalLogging', function () { it('Testing emergency functionality', function () { - spyOn(console, 'log'); - - let log = new Logger(true, false, false); + let log = new Logger(isVerbose, false, false); + spyOn(log, 'write'); log.emergency(); - expect(console.log).toHaveBeenCalled(); + expect(log.write).toHaveBeenCalled(); }); it('Testing alert functionality', function () { - spyOn(console, 'log'); - - let log = new Logger(true, false, false); + let log = new Logger(isVerbose, false, false); + spyOn(log, 'write'); log.alert(); - expect(console.log).toHaveBeenCalled(); + expect(log.write).toHaveBeenCalled(); }); it('Testing critical functionality', function () { - spyOn(console, 'log'); - - let log = new Logger(true, false, false); + let log = new Logger(isVerbose, false, false); + spyOn(log, 'write'); log.critical(); - expect(console.log).toHaveBeenCalled(); + expect(log.write).toHaveBeenCalled(); }); it('Testing error functionality', function () { - spyOn(console, 'log'); - - let log = new Logger(true, false, false); + let log = new Logger(isVerbose, false, false); + spyOn(log, 'write'); log.error(); - expect(console.log).toHaveBeenCalled(); + expect(log.write).toHaveBeenCalled(); }); it('Testing warning functionality', function () { - spyOn(console, 'log'); - - let log = new Logger(true, false, false); + let log = new Logger(isVerbose, false, false); + spyOn(log, 'write'); log.warning(); - expect(console.log).toHaveBeenCalled(); + expect(log.write).toHaveBeenCalled(); }); it('Testing notice functionality', function () { - spyOn(console, 'log'); - - let log = new Logger(true, false, false); + let log = new Logger(isVerbose, false, false); + spyOn(log, 'write'); log.notice(); - expect(console.log).toHaveBeenCalled(); + expect(log.write).toHaveBeenCalled(); }); it('Testing info functionality', function () { - spyOn(console, 'log'); - - let log = new Logger(true, false, false); + let log = new Logger(isVerbose, false, false); + spyOn(log, 'write'); log.info(); - expect(console.log).toHaveBeenCalled(); + expect(log.write).toHaveBeenCalled(); }); it('Testing debug functionality', function () { - spyOn(console, 'log'); - - let log = new Logger(true, false, false); + let log = new Logger(isVerbose, false, false); + spyOn(log, 'write'); log.debug(); - expect(console.log).toHaveBeenCalled(); + expect(log.write).toHaveBeenCalled(); }); it('Testing log functionality', function () { - spyOn(console, 'log'); - - let log = new Logger(true, false, false); + let log = new Logger(isVerbose, false, false); + spyOn(log, 'write'); log.log(); - expect(console.log).toHaveBeenCalled(); + expect(log.write).toHaveBeenCalled(); }); it('Testing log functionality', function () { - spyOn(console, 'log'); - - let log = new Logger(true, false, false); + let log = new Logger(isVerbose, false, false); + spyOn(log, 'write'); log.log(); - expect(console.log).toHaveBeenCalled(); + expect(log.write).toHaveBeenCalled(); }); it('Testing console functionality', function () { + let log = new Logger(isVerbose, false, false); spyOn(console, 'log'); - let log = new Logger(true, false, false); - log.console(); expect(console.log).toHaveBeenCalled(); }); @@ -121,109 +112,98 @@ describe('LoggerTest', function () { it('Testing emergency functionality', function () { - spyOn(console, 'log'); - let log = new Logger(false, false, false); + spyOn(log, 'writeVerbose'); log.emergency(); - expect(console.log).not.toHaveBeenCalled(); + expect(log.writeVerbose).not.toHaveBeenCalled(); }); it('Testing alert functionality', function () { - spyOn(console, 'log'); - let log = new Logger(false, false, false); + spyOn(log, 'writeVerbose'); log.alert(); - expect(console.log).not.toHaveBeenCalled(); + expect(log.writeVerbose).not.toHaveBeenCalled(); }); it('Testing critical functionality', function () { - spyOn(console, 'log'); - let log = new Logger(false, false, false); + spyOn(log, 'writeVerbose'); log.critical(); - expect(console.log).not.toHaveBeenCalled(); + expect(log.writeVerbose).not.toHaveBeenCalled(); }); it('Testing error functionality', function () { - spyOn(console, 'log'); - let log = new Logger(false, false, false); + spyOn(log, 'writeVerbose'); log.error(); - expect(console.log).not.toHaveBeenCalled(); + expect(log.writeVerbose).not.toHaveBeenCalled(); }); it('Testing warning functionality', function () { - spyOn(console, 'log'); - let log = new Logger(false, false, false); + spyOn(log, 'writeVerbose'); log.warning(); - expect(console.log).not.toHaveBeenCalled(); + expect(log.writeVerbose).not.toHaveBeenCalled(); }); it('Testing notice functionality', function () { - spyOn(console, 'log'); - let log = new Logger(false, false, false); + spyOn(log, 'writeVerbose'); log.notice(); - expect(console.log).not.toHaveBeenCalled(); + expect(log.writeVerbose).not.toHaveBeenCalled(); }); it('Testing info functionality', function () { - spyOn(console, 'log'); - let log = new Logger(false, false, false); + spyOn(log, 'writeVerbose'); log.info(); - expect(console.log).not.toHaveBeenCalled(); + expect(log.writeVerbose).not.toHaveBeenCalled(); }); it('Testing debug functionality', function () { - spyOn(console, 'log'); - let log = new Logger(false, false, false); + spyOn(log, 'writeVerbose'); log.debug(); - expect(console.log).not.toHaveBeenCalled(); + expect(log.writeVerbose).not.toHaveBeenCalled(); }); it('Testing log functionality', function () { - spyOn(console, 'log'); - let log = new Logger(false, false, false); + spyOn(log, 'writeVerbose'); log.log(); - expect(console.log).not.toHaveBeenCalled(); + expect(log.writeVerbose).not.toHaveBeenCalled(); }); it('Testing log functionality', function () { - spyOn(console, 'log'); - let log = new Logger(false, false, false); + spyOn(log, 'writeVerbose'); log.log(); - expect(console.log).not.toHaveBeenCalled(); + expect(log.writeVerbose).not.toHaveBeenCalled(); }); it('Testing console functionality', function () { - spyOn(console, 'log'); - let log = new Logger(false, false, false); + spyOn(console, 'log'); log.console(); expect(console.log).toHaveBeenCalled(); diff --git a/tests/Math/MathProcessorTest.js b/tests/Math/MathProcessorTest.js index 3986ee1..4e69770 100755 --- a/tests/Math/MathProcessorTest.js +++ b/tests/Math/MathProcessorTest.js @@ -1,3 +1,5 @@ +import { MathProcessor } from '../../Math/MathProcessor.js'; + describe('MathProcessorTest', function () { 'use strict'; @@ -6,10 +8,10 @@ describe('MathProcessorTest', function () { it('Testing formula evaluation', function () { - expect(jsOMS.mathEvaluate('3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3 + 1.5')).toBeCloseTo(4.5, 2); - expect(jsOMS.mathEvaluate('3+4*2/(1-5)^2^3+1.5')).toBeCloseTo(4.5, 2); - expect(jsOMS.mathEvaluate('invalid')).toBe(null); - expect(jsOMS.mathEvaluate('3+4*2/(1-5^2^3+1.5')).toBe(null); + expect(MathProcessor.mathEvaluate('3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3 + 1.5')).toBeCloseTo(4.5, 2); + expect(MathProcessor.mathEvaluate('3+4*2/(1-5)^2^3+1.5')).toBeCloseTo(4.5, 2); + expect(MathProcessor.mathEvaluate('invalid')).toBe(null); + expect(MathProcessor.mathEvaluate('3+4*2/(1-5^2^3+1.5')).toBe(null); }); }); }); \ No newline at end of file diff --git a/tests/Media/Audio/UISoundTest.js b/tests/Media/Audio/UISoundTest.js deleted file mode 100755 index cabc6dc..0000000 --- a/tests/Media/Audio/UISoundTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('UISoundTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Media/Video/CameraRecognitionTest.js b/tests/Media/Video/CameraRecognitionTest.js deleted file mode 100755 index 579ae8c..0000000 --- a/tests/Media/Video/CameraRecognitionTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('CameraRecognitionTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -} diff --git a/tests/Message/Notification/NotificationLevelTest.js b/tests/Message/Notification/NotificationLevelTest.js index 377899c..733c035 100755 --- a/tests/Message/Notification/NotificationLevelTest.js +++ b/tests/Message/Notification/NotificationLevelTest.js @@ -8,7 +8,7 @@ describe('NotificationLevelTest', function () { it('Testing amount of enums', function () { - expect(Object.keys(NotificationLevel).length).toBe(4); + expect(Object.keys(NotificationLevel).length).toBe(5); }); it('Testing values of enums', function () diff --git a/tests/Message/Notification/NotificationManagerTest.js b/tests/Message/Notification/NotificationManagerTest.js index 112c195..f8f1f14 100755 --- a/tests/Message/Notification/NotificationManagerTest.js +++ b/tests/Message/Notification/NotificationManagerTest.js @@ -1,4 +1,6 @@ import { NotificationManager } from '../../../Message/Notification/NotificationManager.js'; +import { AppNotification } from '../../../Message/Notification/App/AppNotification.js'; +import { BrowserNotification } from '../../../Message/Notification/Browser/BrowserNotification.js'; describe('NotificationManagerTest', function () { @@ -10,8 +12,8 @@ describe('NotificationManagerTest', function () { let manager = new NotificationManager(); - expect(manager.getAppNotifier()).toEqual(jasmine.any(App.AppNotification)); - expect(manager.getBrowserNotifier()).toEqual(jasmine.any(Browser.BrowserNotification)); + expect(manager.getAppNotifier()).toEqual(jasmine.any(AppNotification)); + expect(manager.getBrowserNotifier()).toEqual(jasmine.any(BrowserNotification)); }); }); }); \ No newline at end of file diff --git a/tests/Message/Request/RequestTest.js b/tests/Message/Request/RequestTest.js deleted file mode 100755 index dd785ec..0000000 --- a/tests/Message/Request/RequestTest.js +++ /dev/null @@ -1,13 +0,0 @@ - -describe('RequestTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Message/Request/RequestTypeTest.js b/tests/Message/Request/RequestTypeTest.js index 2810bc2..b241c1e 100755 --- a/tests/Message/Request/RequestTypeTest.js +++ b/tests/Message/Request/RequestTypeTest.js @@ -8,7 +8,7 @@ describe('RequestTypeTest', function () { it('Testing amount of enums', function () { - expect(Object.keys(RequestType).length).toBe(4); + expect(Object.keys(RequestType).length).toBe(5); }); it('Testing values of enums', function () diff --git a/tests/Message/Response/ResponseManagerTest.js b/tests/Message/Response/ResponseManagerTest.js deleted file mode 100755 index 035dedb..0000000 --- a/tests/Message/Response/ResponseManagerTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('ResponseManagerTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Message/Response/ResponseTest.js b/tests/Message/Response/ResponseTest.js deleted file mode 100755 index 80d2863..0000000 --- a/tests/Message/Response/ResponseTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('ResponseTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Module/ModuleFactoryTest.js b/tests/Module/ModuleFactoryTest.js deleted file mode 100755 index c8f071e..0000000 --- a/tests/Module/ModuleFactoryTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('ModuleFactoryTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Module/ModuleManagerTest.js b/tests/Module/ModuleManagerTest.js deleted file mode 100755 index e3e3cc0..0000000 --- a/tests/Module/ModuleManagerTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('ModuleManagerTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Route/RouteTest.js b/tests/Route/RouteTest.js deleted file mode 100755 index 26eb5f7..0000000 --- a/tests/Route/RouteTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('RouteTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Security/Hash/Sha1Test.js b/tests/Security/Hash/Sha1Test.js deleted file mode 100755 index 477aa96..0000000 --- a/tests/Security/Hash/Sha1Test.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('Sha1Test', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Security/Hash/Sha1bTest.js b/tests/Security/Hash/Sha1bTest.js deleted file mode 100755 index 3693644..0000000 --- a/tests/Security/Hash/Sha1bTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('Sha1bTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Socket/Client/ClientTest.js b/tests/Socket/Client/ClientTest.js deleted file mode 100755 index 55ec71a..0000000 --- a/tests/Socket/Client/ClientTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('ClientTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Spreadsheet/CellTest.js b/tests/Spreadsheet/CellTest.js deleted file mode 100755 index f60c3d4..0000000 --- a/tests/Spreadsheet/CellTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('CellTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Spreadsheet/FormattingTest.js b/tests/Spreadsheet/FormattingTest.js deleted file mode 100755 index 277b232..0000000 --- a/tests/Spreadsheet/FormattingTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('FormattingTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Spreadsheet/FunctionsTest.js b/tests/Spreadsheet/FunctionsTest.js deleted file mode 100755 index 3ed199e..0000000 --- a/tests/Spreadsheet/FunctionsTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('FunctionsTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Spreadsheet/SheetTest.js b/tests/Spreadsheet/SheetTest.js deleted file mode 100755 index 0934c5b..0000000 --- a/tests/Spreadsheet/SheetTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('SheetTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Spreadsheet/SpreadsheetTest.js b/tests/Spreadsheet/SpreadsheetTest.js deleted file mode 100755 index c183416..0000000 --- a/tests/Spreadsheet/SpreadsheetTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('SpreadsheetTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/UI/ActionManagerTest.js b/tests/UI/ActionManagerTest.js deleted file mode 100755 index 979e416..0000000 --- a/tests/UI/ActionManagerTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('ActionManagerTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/UI/Component/AutocompleteTest.js b/tests/UI/Component/AutocompleteTest.js deleted file mode 100755 index 4ce1b5f..0000000 --- a/tests/UI/Component/AutocompleteTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('AutocompleteTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/UI/Component/FormTest.js b/tests/UI/Component/FormTest.js deleted file mode 100755 index 831747b..0000000 --- a/tests/UI/Component/FormTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('FormTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/UI/Component/InputTest.js b/tests/UI/Component/InputTest.js deleted file mode 100755 index e6d4490..0000000 --- a/tests/UI/Component/InputTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('InputTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/UI/Component/TabTest.js b/tests/UI/Component/TabTest.js deleted file mode 100755 index 4f627cf..0000000 --- a/tests/UI/Component/TabTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('TabTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/UI/Component/TableTest.js b/tests/UI/Component/TableTest.js deleted file mode 100755 index b952758..0000000 --- a/tests/UI/Component/TableTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('TableTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/UI/Component/TagInputTest.js b/tests/UI/Component/TagInputTest.js deleted file mode 100755 index 7f1196c..0000000 --- a/tests/UI/Component/TagInputTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('TagInputTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/UI/Component/TagListTest.js b/tests/UI/Component/TagListTest.js deleted file mode 100755 index 10ba17d..0000000 --- a/tests/UI/Component/TagListTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('TagListTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); \ No newline at end of file diff --git a/tests/UI/DragNDropTest.js b/tests/UI/DragNDropTest.js deleted file mode 100755 index a7b0d90..0000000 --- a/tests/UI/DragNDropTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('DragNDropTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/UI/GeneralUITest.js b/tests/UI/GeneralUITest.js deleted file mode 100755 index 9592efc..0000000 --- a/tests/UI/GeneralUITest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('GeneralUITest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/UI/Input/InputManagerTest.js b/tests/UI/Input/InputManagerTest.js deleted file mode 100755 index 8dce574..0000000 --- a/tests/UI/Input/InputManagerTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('InputManagerTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/UI/Input/Keyboard/KeyboardManagerTest.js b/tests/UI/Input/Keyboard/KeyboardManagerTest.js deleted file mode 100755 index 1b7ad59..0000000 --- a/tests/UI/Input/Keyboard/KeyboardManagerTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('KeyboardManagerTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/UI/Input/Math/EvaluatorTest.js b/tests/UI/Input/Math/EvaluatorTest.js deleted file mode 100644 index bbaab65..0000000 --- a/tests/UI/Input/Math/EvaluatorTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('EvaluatorTest', function () -{ - "use strict"; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/UI/Input/Mouse/MouseManagerTest.js b/tests/UI/Input/Mouse/MouseManagerTest.js deleted file mode 100755 index 592df33..0000000 --- a/tests/UI/Input/Mouse/MouseManagerTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('MouseManagerTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/UI/Input/Touch/TouchManagerTest.js b/tests/UI/Input/Touch/TouchManagerTest.js deleted file mode 100755 index a00e9e9..0000000 --- a/tests/UI/Input/Touch/TouchManagerTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('TouchManagerTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/UI/Input/Voice/ReadManagerTest.js b/tests/UI/Input/Voice/ReadManagerTest.js deleted file mode 100755 index a66ee24..0000000 --- a/tests/UI/Input/Voice/ReadManagerTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('ReadManagerTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -} diff --git a/tests/UI/Input/Voice/SpeechManagerTest.js b/tests/UI/Input/Voice/SpeechManagerTest.js deleted file mode 100755 index dc4b4af..0000000 --- a/tests/UI/Input/Voice/SpeechManagerTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('SpeechManagerTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -} diff --git a/tests/UI/Input/Voice/VoiceManagerTest.js b/tests/UI/Input/Voice/VoiceManagerTest.js deleted file mode 100755 index 264dd44..0000000 --- a/tests/UI/Input/Voice/VoiceManagerTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('VoiceManagerTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -} diff --git a/tests/UI/LoaderTest.js b/tests/UI/LoaderTest.js deleted file mode 100755 index a6dfbf3..0000000 --- a/tests/UI/LoaderTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('LoaderTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/UI/UIManagerTest.js b/tests/UI/UIManagerTest.js deleted file mode 100755 index 038570f..0000000 --- a/tests/UI/UIManagerTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('UIManagerTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/UnhandledExceptionTest.js b/tests/UnhandledExceptionTest.js deleted file mode 100755 index 4bc7ae5..0000000 --- a/tests/UnhandledExceptionTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('UnhandledExceptionTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Uri/UriFactoryTest.js b/tests/Uri/UriFactoryTest.js index 003f5c1..9b50e99 100755 --- a/tests/Uri/UriFactoryTest.js +++ b/tests/Uri/UriFactoryTest.js @@ -4,6 +4,10 @@ describe('UriFactoryTest', function () { 'use strict'; + if (typeof window === 'undefined') { + var window = { location: {} }; + } + describe('testDefault', function () { it('Testing default functionality', function () diff --git a/tests/Utils/oLibTest.js b/tests/Utils/oLibTest.js deleted file mode 100755 index 8f186b3..0000000 --- a/tests/Utils/oLibTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('oLibTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -}); diff --git a/tests/Views/FormViewTest.js b/tests/Views/FormViewTest.js index 07c46d3..e6ad17e 100755 --- a/tests/Views/FormViewTest.js +++ b/tests/Views/FormViewTest.js @@ -1,8 +1,19 @@ +import { jsOMS } from '../../Utils/oLib.js'; + describe('FormViewTest', function () { 'use strict'; var testId = 'testForm'; + it('Testing environment', function () + { + expect(true).toBeTrue(); + }); + + if (typeof document === 'undefined') { + return; + } + beforeEach(function () { document.body.innerHTML += ` diff --git a/tests/Views/TableViewTest.js b/tests/Views/TableViewTest.js deleted file mode 100755 index 251b2dc..0000000 --- a/tests/Views/TableViewTest.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('TableViewTest', function () -{ - 'use strict'; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -});