mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-01-11 09:58:39 +00:00
Implement more tests
This commit is contained in:
parent
a51765231b
commit
23b0fa4d73
40
Account/Account.js
Normal file
40
Account/Account.js
Normal file
|
|
@ -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 || {}));
|
||||
|
|
@ -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 || {}));
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
14
tests/Account/AccountTest.js
Normal file
14
tests/Account/AccountTest.js
Normal file
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
describe('AccountTypeTest', function ()
|
||||
{
|
||||
"use strict";
|
||||
|
||||
beforeEach(function ()
|
||||
{
|
||||
});
|
||||
|
||||
afterEach(function ()
|
||||
{
|
||||
});
|
||||
}
|
||||
18
tests/Account/AccountTypeTest.js
Normal file
18
tests/Account/AccountTypeTest.js
Normal file
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -19,17 +19,22 @@
|
|||
<script src="../Asset/AssetManager.js"></script>
|
||||
<script src="../Autoloader.js"></script>
|
||||
|
||||
<script src="../Account/Account.js"></script>
|
||||
<script src="../Account/AccountManager.js"></script>
|
||||
<script src="../Account/AccountType.js"></script>
|
||||
|
||||
<script src="../Uri/Http.js"></script>
|
||||
<script src="../Uri/UriFactory.js"></script>
|
||||
|
||||
<script src="../Views/FormView.js"></script>
|
||||
|
||||
<!-- include spec files here... -->
|
||||
<script src="Account/AccountTest.js"></script>
|
||||
<script src="Account/AccountManagerTest.js"></script>
|
||||
<script src="Account/AccountTypeTest.js"></script>
|
||||
|
||||
<script src="Asset/AssetManagerTest.js"></script>
|
||||
|
||||
<script src="Uri/HttpTest.js"></script>
|
||||
<script src="Uri/UriFactoryTest.js"></script>
|
||||
|
||||
<script src="UI/Views/FormViewTest.js"></script>
|
||||
<script src="UI/Asset/AssetManagerTest.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -2,15 +2,6 @@ describe('HttpTest', function ()
|
|||
{
|
||||
"use strict";
|
||||
|
||||
/** global: jsOMS */
|
||||
beforeEach(function ()
|
||||
{
|
||||
});
|
||||
|
||||
afterEach(function ()
|
||||
{
|
||||
});
|
||||
|
||||
describe('testParseUrl', function ()
|
||||
{
|
||||
it('Testing php parsing mode', function ()
|
||||
|
|
|
|||
|
|
@ -2,15 +2,6 @@ describe('UriFactoryTest', function ()
|
|||
{
|
||||
"use strict";
|
||||
|
||||
/** global: jsOMS */
|
||||
beforeEach(function ()
|
||||
{
|
||||
});
|
||||
|
||||
afterEach(function ()
|
||||
{
|
||||
});
|
||||
|
||||
describe('testDefault', function ()
|
||||
{
|
||||
it('Testing default functionality', function ()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user