diff --git a/Account/Account.js b/Account/Account.js new file mode 100644 index 0000000..c0f7d0f --- /dev/null +++ b/Account/Account.js @@ -0,0 +1,40 @@ +/** + * Account Manager. + * + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @since 1.0.0 + */ +(function (jsOMS) +{ + "use strict"; + + jsOMS.Autoloader.defineNamespace('jsOMS.Account'); + + jsOMS.Account.Account = class { + /** + * @constructor + * + * @since 1.0.0 + */ + constructor () + { + this.id = 0; + }; + + /** + * Get id. + * + * @return {int} + * + * @method + * + * @since 1.0.0 + */ + getId () + { + return this.id; + }; + }; +}(window.jsOMS = window.jsOMS || {})); \ No newline at end of file diff --git a/Account/AccountManager.js b/Account/AccountManager.js index f3a829b..d803642 100644 --- a/Account/AccountManager.js +++ b/Account/AccountManager.js @@ -11,7 +11,6 @@ "use strict"; jsOMS.Autoloader.defineNamespace('jsOMS.Account'); - jsOMS.Account.AccountManager = class { /** @@ -63,7 +62,7 @@ * * @param {int} id Account id * - * @return {Object} + * @return {null|Object} * * @method * @@ -75,7 +74,7 @@ return this.accounts[id]; } - return undefined; + return null; }; } }(window.jsOMS = window.jsOMS || {})); diff --git a/Account/AccountType.enum.js b/Account/AccountType.js similarity index 100% rename from Account/AccountType.enum.js rename to Account/AccountType.js diff --git a/tests/Account/AccountManagerTest.js b/tests/Account/AccountManagerTest.js index b389c74..4e55ca6 100644 --- a/tests/Account/AccountManagerTest.js +++ b/tests/Account/AccountManagerTest.js @@ -1,12 +1,29 @@ -describe('AccountManagerTest', function () +describe('AccounManagertTest', function () { "use strict"; - beforeEach(function () + describe('testDefault', function () { + it('Testing default functionality', function () + { + let obj = new jsOMS.Account.AccountManager(); + + expect(obj.get(2)).toBe(null); + }); }); - afterEach(function () + describe('testSetGet', function () { + it('Testing default functionality', function () + { + let obj = new jsOMS.Account.AccountManager(); + let acc = new jsOMS.Account.Account(); + + obj.add(acc); + expect(obj.get(0)).toBe(acc); + + obj.remove(0); + expect(obj.get(0)).toBe(null); + }); }); }); diff --git a/tests/Account/AccountTest.js b/tests/Account/AccountTest.js new file mode 100644 index 0000000..4d0c825 --- /dev/null +++ b/tests/Account/AccountTest.js @@ -0,0 +1,14 @@ +describe('AccountTest', function () +{ + "use strict"; + + describe('testDefault', function () + { + it('Testing default functionality', function () + { + let obj = new jsOMS.Account.Account(); + + expect(obj.getId()).toBe(0); + }); + }); +}); diff --git a/tests/Account/AccountTypeTest.enum b/tests/Account/AccountTypeTest.enum deleted file mode 100644 index 206f369..0000000 --- a/tests/Account/AccountTypeTest.enum +++ /dev/null @@ -1,12 +0,0 @@ -describe('AccountTypeTest', function () -{ - "use strict"; - - beforeEach(function () - { - }); - - afterEach(function () - { - }); -} diff --git a/tests/Account/AccountTypeTest.js b/tests/Account/AccountTypeTest.js new file mode 100644 index 0000000..3694a64 --- /dev/null +++ b/tests/Account/AccountTypeTest.js @@ -0,0 +1,18 @@ +describe('AccountTypeTest', function () +{ + "use strict"; + + describe('testEnum', function () + { + it('Testing amount of enums', function () + { + expect(Object.keys(jsOMS.Account.AccountType).length).toBe(2); + }); + + it('Testing amount of enums', function () + { + expect(jsOMS.Account.AccountType.USER).toBe(0); + expect(jsOMS.Account.AccountType.GROUP).toBe(1); + }); + }); +}); diff --git a/tests/Asset/AssetManagerTest.js b/tests/Asset/AssetManagerTest.js index e544a40..65f443c 100644 --- a/tests/Asset/AssetManagerTest.js +++ b/tests/Asset/AssetManagerTest.js @@ -2,14 +2,6 @@ describe('AssetManagerTest', function () { "use strict"; - beforeEach(function () - { - }); - - afterEach(function () - { - }); - describe('testDefault', function () { it('Testing default functionality', function () @@ -24,10 +16,14 @@ describe('AssetManagerTest', function () { it('Testing asset interaction functionality', function () { - let asset = new jsOMS.Asset.AssetManager(); - expect(asset.get('../../../jsOMS/Utils/oLib.js')).not.toBe(null); - expect(asset.remove('../../../jsOMS/Utils/oLib.js')).toBeTruthy(); - expect(asset.load('../../../jsOMS/Utils/oLib.js', 'js')).not.toBeFalsy(); + let asset = new jsOMS.Asset.AssetManager(), + base = window.location.href.substr(0, window.location.href.length - 15); + + asset.registerLoadedAssets(); + + 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/SpecRunner.html b/tests/SpecRunner.html index b06158e..574301d 100644 --- a/tests/SpecRunner.html +++ b/tests/SpecRunner.html @@ -19,17 +19,22 @@ + + + + - - + + + + + + - - - diff --git a/tests/Uri/HttpTest.js b/tests/Uri/HttpTest.js index d255590..1c2760d 100644 --- a/tests/Uri/HttpTest.js +++ b/tests/Uri/HttpTest.js @@ -2,15 +2,6 @@ describe('HttpTest', function () { "use strict"; - /** global: jsOMS */ - beforeEach(function () - { - }); - - afterEach(function () - { - }); - describe('testParseUrl', function () { it('Testing php parsing mode', function () diff --git a/tests/Uri/UriFactoryTest.js b/tests/Uri/UriFactoryTest.js index 504c16a..36c77b5 100644 --- a/tests/Uri/UriFactoryTest.js +++ b/tests/Uri/UriFactoryTest.js @@ -2,15 +2,6 @@ describe('UriFactoryTest', function () { "use strict"; - /** global: jsOMS */ - beforeEach(function () - { - }); - - afterEach(function () - { - }); - describe('testDefault', function () { it('Testing default functionality', function ()