dyo-tools 0.3.2 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{dist/constants.d.ts → constants.d.ts} +1 -0
- package/constants.d.ts.map +1 -0
- package/constants.js +67 -0
- package/constants.js.map +1 -0
- package/core/DTAction.d.ts +12 -0
- package/core/DTAction.d.ts.map +1 -0
- package/{dist/core → core}/DTAction.js +3 -6
- package/core/DTAction.js.map +1 -0
- package/{dist/core → core}/DTBunch.d.ts +8 -5
- package/core/DTBunch.d.ts.map +1 -0
- package/{dist/core → core}/DTBunch.js +53 -19
- package/core/DTBunch.js.map +1 -0
- package/core/DTComponent.d.ts +31 -0
- package/core/DTComponent.d.ts.map +1 -0
- package/{dist/core → core}/DTComponent.js +23 -10
- package/core/DTComponent.js.map +1 -0
- package/core/DTComponentPhysical.d.ts +16 -0
- package/core/DTComponentPhysical.d.ts.map +1 -0
- package/core/DTComponentPhysical.js +37 -0
- package/core/DTComponentPhysical.js.map +1 -0
- package/core/DTComponentWithMeta.d.ts +12 -0
- package/core/DTComponentWithMeta.d.ts.map +1 -0
- package/core/DTComponentWithMeta.js +46 -0
- package/core/DTComponentWithMeta.js.map +1 -0
- package/core/DTElement.d.ts +15 -0
- package/core/DTElement.d.ts.map +1 -0
- package/{dist/core → core}/DTElement.js +8 -9
- package/core/DTElement.js.map +1 -0
- package/core/DTError.d.ts +14 -0
- package/core/DTError.d.ts.map +1 -0
- package/{dist/core → core}/DTError.js +1 -5
- package/core/DTError.js.map +1 -0
- package/core/DTManager.d.ts +36 -0
- package/core/DTManager.d.ts.map +1 -0
- package/{dist/core → core}/DTManager.js +84 -26
- package/core/DTManager.js.map +1 -0
- package/core/DTMaster.d.ts +27 -0
- package/core/DTMaster.d.ts.map +1 -0
- package/{dist/core → core}/DTMaster.js +48 -31
- package/core/DTMaster.js.map +1 -0
- package/core/DTModule.d.ts +17 -0
- package/core/DTModule.d.ts.map +1 -0
- package/{dist/core → core}/DTModule.js +6 -6
- package/core/DTModule.js.map +1 -0
- package/{src/index.ts → index.d.ts} +14 -17
- package/index.d.ts.map +1 -0
- package/{dist/index.d.ts → index.js} +1 -0
- package/index.js.map +1 -0
- package/{dist/libs → libs}/DYOFinder.d.ts +1 -0
- package/libs/DYOFinder.d.ts.map +1 -0
- package/{dist/libs → libs}/DYOFinder.js +10 -14
- package/libs/DYOFinder.js.map +1 -0
- package/libs/dix/DIXModule.module.d.ts +8 -0
- package/libs/dix/DIXModule.module.d.ts.map +1 -0
- package/libs/dix/DIXModule.module.js +73 -0
- package/libs/player/DTPlayer.element.d.ts +6 -0
- package/libs/player/DTPlayer.element.d.ts.map +1 -0
- package/libs/player/DTPlayer.element.js +7 -0
- package/libs/player/DTPlayer.element.js.map +1 -0
- package/libs/player/DTPlayer.manager.d.ts +12 -0
- package/libs/player/DTPlayer.manager.d.ts.map +1 -0
- package/libs/player/DTPlayer.manager.js +35 -0
- package/libs/player/DTPlayer.manager.js.map +1 -0
- package/package.json +9 -47
- package/tsconfig.dev.tsbuildinfo +1 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/{dist/types → types}/core.d.ts +40 -12
- package/types/core.d.ts.map +1 -0
- package/{dist/types → types}/core.js +2 -6
- package/types/core.js.map +1 -0
- package/{src/types/index.ts → types/index.d.ts} +3 -2
- package/types/index.d.ts.map +1 -0
- package/types/index.js.map +1 -0
- package/{dist/types → types}/player.d.ts +1 -1
- package/types/player.d.ts.map +1 -0
- package/types/player.js +1 -0
- package/.c8rc.json +0 -4
- package/.eslintignore +0 -2
- package/.eslintrc.json +0 -47
- package/Makefile +0 -34
- package/README.md +0 -0
- package/babel.config.js +0 -1
- package/cucumber-report.html +0 -48
- package/dist/constants.js +0 -63
- package/dist/constants.js.map +0 -1
- package/dist/core/DTAction.d.ts +0 -10
- package/dist/core/DTAction.js.map +0 -1
- package/dist/core/DTBunch.js.map +0 -1
- package/dist/core/DTComponent.d.ts +0 -28
- package/dist/core/DTComponent.js.map +0 -1
- package/dist/core/DTComponentPhysical.d.ts +0 -13
- package/dist/core/DTComponentPhysical.js +0 -22
- package/dist/core/DTComponentPhysical.js.map +0 -1
- package/dist/core/DTComponentWithMeta.d.ts +0 -9
- package/dist/core/DTComponentWithMeta.js +0 -32
- package/dist/core/DTComponentWithMeta.js.map +0 -1
- package/dist/core/DTElement.d.ts +0 -13
- package/dist/core/DTElement.js.map +0 -1
- package/dist/core/DTError.d.ts +0 -13
- package/dist/core/DTError.js.map +0 -1
- package/dist/core/DTManager.d.ts +0 -33
- package/dist/core/DTManager.js.map +0 -1
- package/dist/core/DTMaster.d.ts +0 -24
- package/dist/core/DTMaster.js.map +0 -1
- package/dist/core/DTModule.d.ts +0 -14
- package/dist/core/DTModule.js.map +0 -1
- package/dist/index.js +0 -28
- package/dist/index.js.map +0 -1
- package/dist/libs/DYOFinder.js.map +0 -1
- package/dist/libs/player/DTPlayer.element.d.ts +0 -5
- package/dist/libs/player/DTPlayer.element.js +0 -11
- package/dist/libs/player/DTPlayer.element.js.map +0 -1
- package/dist/libs/player/DTPlayer.manager.d.ts +0 -11
- package/dist/libs/player/DTPlayer.manager.js +0 -42
- package/dist/libs/player/DTPlayer.manager.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types/core.js.map +0 -1
- package/dist/types/index.js +0 -19
- package/dist/types/index.js.map +0 -1
- package/dist/types/player.js +0 -3
- package/docs/.nojekyll +0 -1
- package/docs/assets/highlight.css +0 -29
- package/docs/assets/main.js +0 -59
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1414
- package/docs/classes/core_DTAction.DYOToolsAction.html +0 -89
- package/docs/classes/core_DTBunch.DYOToolsBunch.html +0 -254
- package/docs/classes/core_DTComponent.DYOToolsComponent.html +0 -76
- package/docs/classes/core_DTComponentPhysical.DYOToolsComponentPhysical.html +0 -110
- package/docs/classes/core_DTComponentWithMeta.DYOToolsComponentWithMeta.html +0 -96
- package/docs/classes/core_DTElement.DYOToolsElement.html +0 -135
- package/docs/classes/core_DTError.DYOToolsError.html +0 -37
- package/docs/classes/core_DTManager.DYOToolsManager.html +0 -237
- package/docs/classes/core_DTMaster.DYOToolsMaster.html +0 -150
- package/docs/classes/core_DTModule.DYOToolsModule.html +0 -92
- package/docs/classes/libs_DYOFinder.DYOFinder.html +0 -34
- package/docs/classes/libs_player_DTPlayer_element.DYOToolsPlayer.html +0 -134
- package/docs/classes/libs_player_DTPlayer_manager.DYOToolsPlayerManager.html +0 -243
- package/docs/enums/types_core.FilterOperatorType.html +0 -10
- package/docs/hierarchy.html +0 -1
- package/docs/index.html +0 -1
- package/docs/interfaces/types_core.DTBunchFilters.html +0 -6
- package/docs/interfaces/types_core.DTBunchOptions.html +0 -19
- package/docs/interfaces/types_core.DTBunchToObject.html +0 -7
- package/docs/interfaces/types_core.DTComponentOptions.html +0 -5
- package/docs/interfaces/types_core.DTComponentToObject.html +0 -4
- package/docs/interfaces/types_core.DTElementToObject.html +0 -7
- package/docs/interfaces/types_core.DTManagerFilters.html +0 -6
- package/docs/interfaces/types_core.DTManagerOptions.html +0 -8
- package/docs/interfaces/types_core.DTManagerToObject.html +0 -5
- package/docs/interfaces/types_core.DTMasterToObject.html +0 -8
- package/docs/interfaces/types_core.DTModuleToObject.html +0 -6
- package/docs/interfaces/types_core.DYOFinderConfigurationPropDefault.html +0 -4
- package/docs/interfaces/types_core.DYOFinderConfigurationPropObjectSearch.html +0 -4
- package/docs/interfaces/types_core.DYOFinderFilterOperatorAdvanced.html +0 -5
- package/docs/interfaces/types_core.DYOFinderFilterOperatorBase.html +0 -5
- package/docs/interfaces/types_player.DTPlayerManagerSimpleConfiguration.html +0 -3
- package/docs/modules/constants.html +0 -6
- package/docs/modules/core_DTAction.html +0 -2
- package/docs/modules/core_DTBunch.html +0 -2
- package/docs/modules/core_DTComponent.html +0 -2
- package/docs/modules/core_DTComponentPhysical.html +0 -2
- package/docs/modules/core_DTComponentWithMeta.html +0 -2
- package/docs/modules/core_DTElement.html +0 -2
- package/docs/modules/core_DTError.html +0 -2
- package/docs/modules/core_DTManager.html +0 -2
- package/docs/modules/core_DTMaster.html +0 -2
- package/docs/modules/core_DTModule.html +0 -2
- package/docs/modules/libs_DYOFinder.html +0 -2
- package/docs/modules/libs_player_DTPlayer_element.html +0 -2
- package/docs/modules/libs_player_DTPlayer_manager.html +0 -2
- package/docs/modules/types.html +0 -29
- package/docs/modules/types_core.html +0 -28
- package/docs/modules/types_player.html +0 -2
- package/docs/types/types_core.DTAcceptedMetaData.html +0 -2
- package/docs/types/types_core.DTManagerItemType.html +0 -1
- package/docs/types/types_core.DTManagerItemsType.html +0 -2
- package/docs/types/types_core.DYOFinderComponentType.html +0 -1
- package/docs/types/types_core.DYOFinderConfiguration.html +0 -2
- package/docs/types/types_core.DYOFinderConfigurationProp.html +0 -1
- package/docs/types/types_core.DYOFinderFilterOperator.html +0 -1
- package/docs/types/types_core.DYOFinderFilterOperatorArgument.html +0 -1
- package/docs/types/types_core.DYOFinderFilters.html +0 -1
- package/docs/types/types_core.StandardPrimitiveType.html +0 -2
- package/docs/types/types_core.StandardPrimitiveTypeWithArray.html +0 -1
- package/docs/variables/constants.bunchDefaultOptions.html +0 -2
- package/docs/variables/constants.componentBunchDefaultFinderConfiguration.html +0 -1
- package/docs/variables/constants.componentManagerDefaultFinderConfiguration.html +0 -1
- package/docs/variables/constants.componentPhysicalDefaultFinderConfiguration.html +0 -1
- package/docs/variables/constants.managerDefaultOptions.html +0 -2
- package/jest.config.js +0 -6
- package/src/constants.ts +0 -85
- package/src/core/DTAction.ts +0 -52
- package/src/core/DTBunch.ts +0 -467
- package/src/core/DTComponent.ts +0 -225
- package/src/core/DTComponentPhysical.ts +0 -54
- package/src/core/DTComponentWithMeta.ts +0 -65
- package/src/core/DTElement.ts +0 -102
- package/src/core/DTError.ts +0 -78
- package/src/core/DTManager.ts +0 -465
- package/src/core/DTMaster.ts +0 -318
- package/src/core/DTModule.ts +0 -90
- package/src/libs/DYOFinder.ts +0 -175
- package/src/libs/player/DTPlayer.element.ts +0 -9
- package/src/libs/player/DTPlayer.manager.ts +0 -84
- package/src/types/core.ts +0 -169
- package/src/types/player.ts +0 -6
- package/test/core/DTAction.double.ts +0 -78
- package/test/core/DTAction.spec.ts +0 -76
- package/test/core/DTBunch.double.ts +0 -261
- package/test/core/DTBunch.spec.ts +0 -910
- package/test/core/DTComponent.double.ts +0 -164
- package/test/core/DTComponent.spec.ts +0 -295
- package/test/core/DTComponentPhysical.double.ts +0 -76
- package/test/core/DTComponentPhysical.spec.ts +0 -78
- package/test/core/DTComponentWithMeta.double.ts +0 -115
- package/test/core/DTComponentWithMeta.spec.ts +0 -124
- package/test/core/DTElement.double.ts +0 -163
- package/test/core/DTElement.spec.ts +0 -146
- package/test/core/DTError.double.ts +0 -92
- package/test/core/DTError.spec.ts +0 -89
- package/test/core/DTManager.double.ts +0 -216
- package/test/core/DTManager.spec.ts +0 -965
- package/test/core/DTMaster.double.ts +0 -141
- package/test/core/DTMaster.spec.ts +0 -584
- package/test/core/DTModule.double.ts +0 -80
- package/test/core/DTModule.spec.ts +0 -138
- package/test/core/copy.spec.ts +0 -243
- package/test/libs/DYOFinder.double.ts +0 -152
- package/test/libs/DYOFinder.spec.ts +0 -194
- package/test/libs/player/DTPlayer.element.double.ts +0 -55
- package/test/libs/player/DTPlayer.element.spec.ts +0 -28
- package/test/libs/player/DTPlayer.manager.double.ts +0 -92
- package/test/libs/player/DTPlayer.manager.spec.ts +0 -178
- package/tsconfig.dev.json +0 -22
- package/tsconfig.json +0 -21
- /package/{dist/types/index.d.ts → types/index.js} +0 -0
- /package/{dist/types → types}/player.js.map +0 -0
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import {afterEach, beforeEach, describe, expect, jest, test,} from '@jest/globals';
|
|
2
|
-
import {CodeTest, DTErrorTest, MessageTest, TimestampTest,} from './DTError.double';
|
|
3
|
-
import {DTComponentStub, IDTest as ComponentIdTest} from './DTComponent.double';
|
|
4
|
-
|
|
5
|
-
/************************* TESTS SUITES *******************************/
|
|
6
|
-
describe('class DYOToolsError', () => {
|
|
7
|
-
let errorTest: DTErrorTest;
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
errorTest = new DTErrorTest(CodeTest, MessageTest);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
afterEach(() => {
|
|
14
|
-
jest.resetAllMocks();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
describe('constructor()', () => {
|
|
18
|
-
test('creation with standard field (code, message and timestamp)', () => {
|
|
19
|
-
const newError = new DTErrorTest(CodeTest, MessageTest);
|
|
20
|
-
const currentDate = new Date();
|
|
21
|
-
|
|
22
|
-
expect(newError.th_get_code()).toBe(CodeTest);
|
|
23
|
-
expect(newError.th_get_message()).toBe(MessageTest);
|
|
24
|
-
expect(newError.th_get_timestamp().toDateString()).toBe(currentDate.toDateString());
|
|
25
|
-
expect(newError.th_get_timestamp().toTimeString()).toBe(currentDate.toTimeString());
|
|
26
|
-
expect(newError.th_get_initiator()).toBeUndefined();
|
|
27
|
-
expect(newError.th_get_convicted()).toBeUndefined();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('creation with initiator component', () => {
|
|
31
|
-
const initiatorMock = new DTComponentStub('initiator');
|
|
32
|
-
const newError = new DTErrorTest(CodeTest, MessageTest, initiatorMock);
|
|
33
|
-
|
|
34
|
-
expect(newError.th_get_initiator().getId()).toBe(`${ComponentIdTest}-initiator`);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('creation with initiator and convicted component', () => {
|
|
38
|
-
const initiatorMock = new DTComponentStub('initiator');
|
|
39
|
-
const convictedMock = new DTComponentStub('convicted');
|
|
40
|
-
const newError = new DTErrorTest(CodeTest, MessageTest, initiatorMock, convictedMock);
|
|
41
|
-
|
|
42
|
-
expect(newError.th_get_convicted().getId()).toBe(`${ComponentIdTest}-convicted`);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
describe('getCode()', () => {
|
|
47
|
-
test('return code property', () => {
|
|
48
|
-
expect(errorTest.getCode()).toBe(CodeTest);
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
describe('getMessage()', () => {
|
|
53
|
-
test('return message property', () => {
|
|
54
|
-
expect(errorTest.getMessage()).toBe(MessageTest);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
describe('getTimestamp()', () => {
|
|
59
|
-
test('return timestamp property', () => {
|
|
60
|
-
errorTest.th_set_timestamp(new Date(TimestampTest));
|
|
61
|
-
|
|
62
|
-
expect(errorTest.getTimestamp().getTime()).toBe(TimestampTest);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
describe('getInitiator()', () => {
|
|
67
|
-
test('return empty initiator component by default', () => {
|
|
68
|
-
expect(errorTest.getInitiator()).toBeUndefined();
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test('return initiator component when set', () => {
|
|
72
|
-
errorTest.th_set_initiator(new DTComponentStub('initiator'));
|
|
73
|
-
|
|
74
|
-
expect(errorTest.getInitiator().getId()).toBe(`${ComponentIdTest}-initiator`);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
describe('getConvicted()', () => {
|
|
79
|
-
test('return empty convicted component by default', () => {
|
|
80
|
-
expect(errorTest.getConvicted()).toBeUndefined();
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
test('return convicted component when set', () => {
|
|
84
|
-
errorTest.th_set_convicted(new DTComponentStub('convicted'));
|
|
85
|
-
|
|
86
|
-
expect(errorTest.getConvicted().getId()).toBe(`${ComponentIdTest}-convicted`);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
});
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import {expect} from '@jest/globals';
|
|
2
|
-
import {DTElement, DTManager} from '../../src';
|
|
3
|
-
import {
|
|
4
|
-
bunch1IdTest,
|
|
5
|
-
bunch1toObjectTest,
|
|
6
|
-
bunch2IdTest,
|
|
7
|
-
bunch2toObjectTest,
|
|
8
|
-
bunch3IdTest,
|
|
9
|
-
bunch3toObjectTest,
|
|
10
|
-
defaultOptions,
|
|
11
|
-
DTBunchStubLibrary,
|
|
12
|
-
DTBunchTest,
|
|
13
|
-
generateMockedElements,
|
|
14
|
-
} from './DTBunch.double';
|
|
15
|
-
import {DTAcceptedMetaData, DTManagerItemsType, DTManagerOptions, DTManagerToObject} from '../../src/types';
|
|
16
|
-
import DYOFinder from '../../src/libs/DYOFinder';
|
|
17
|
-
|
|
18
|
-
/** ****************** STUB PROPERTIES CONSTANTS
|
|
19
|
-
* Fixed properties to use with double classes, avoid auto generated and easy checking on test
|
|
20
|
-
* **** */
|
|
21
|
-
export const IDTest = 'DTManager-id-1234567';
|
|
22
|
-
export const KeyTest = 'DTManager-key-1234567';
|
|
23
|
-
export const DomainTest = 'DTManager-domain-test';
|
|
24
|
-
export const ScopesTest = ['DTManager-scope-test1', 'DTManager-scope-test2'];
|
|
25
|
-
|
|
26
|
-
// Specific Manager constants
|
|
27
|
-
export const manager1IDTest = `${IDTest}_1`;
|
|
28
|
-
export const manager1KeyTest = `${KeyTest}_1`;
|
|
29
|
-
|
|
30
|
-
export const manager1ToObject: DTManagerToObject = {
|
|
31
|
-
id: manager1IDTest,
|
|
32
|
-
key: manager1KeyTest,
|
|
33
|
-
type: 'manager',
|
|
34
|
-
items: [
|
|
35
|
-
{
|
|
36
|
-
scope: 'default',
|
|
37
|
-
...bunch1toObjectTest
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** ****************** HELPER TEST CLASS
|
|
43
|
-
* Helper test class, inherits the main component
|
|
44
|
-
* Providing methods to property access and other facilities, in order to avoid using class methods
|
|
45
|
-
* **** */
|
|
46
|
-
export class DTManagerTest extends DTManager<DTElement<DTAcceptedMetaData>> {
|
|
47
|
-
th_get_id(): string {
|
|
48
|
-
return this._id;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
th_set_id(id: string): void {
|
|
52
|
-
this._id = id;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
th_get_key(): string {
|
|
56
|
-
return this._key;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
th_set_key(key: string): void {
|
|
60
|
-
this._key = key;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
th_get_componentType(): string {
|
|
64
|
-
return this._componentType;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
th_get_domain(): string {
|
|
68
|
-
return this._domain;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
th_set_domain(domain: string): void {
|
|
72
|
-
this._domain = domain;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
th_get_items(): any {
|
|
76
|
-
return this._items;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
th_set_items(items: DTManagerItemsType<DTElement<DTAcceptedMetaData>>): void {
|
|
80
|
-
this._items = items;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
th_get_single_item(id: string): any {
|
|
84
|
-
return this._items[id];
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
th_get_scopes(): any {
|
|
88
|
-
return this._scopes;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
th_set_scopes(scopes: any): void {
|
|
92
|
-
this._scopes = scopes;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
th_get_library(): any {
|
|
96
|
-
return this._library;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
th_set_library(library: any): void {
|
|
100
|
-
this._library = library;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
th_set_options(options: any): void {
|
|
104
|
-
this._options = {
|
|
105
|
-
...this._options,
|
|
106
|
-
...options,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
th_get_finder(): DYOFinder {
|
|
111
|
-
return this._finder;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
th_get_options(): DTManagerOptions {
|
|
115
|
-
return this._options;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/** ****************** STUB CLASS
|
|
120
|
-
* Stub class, for using in other component
|
|
121
|
-
* **** */
|
|
122
|
-
export class DTManagerStub extends DTManagerTest {
|
|
123
|
-
constructor() {
|
|
124
|
-
super();
|
|
125
|
-
this._id = IDTest;
|
|
126
|
-
this._key = KeyTest;
|
|
127
|
-
this._errors = [];
|
|
128
|
-
this._library = new DTBunchStubLibrary();
|
|
129
|
-
this._scopes = [
|
|
130
|
-
'default',
|
|
131
|
-
'virtual',
|
|
132
|
-
...ScopesTest,
|
|
133
|
-
];
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
getId(): string {
|
|
137
|
-
return IDTest;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
getKey(): string {
|
|
141
|
-
return KeyTest;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export class DTManagerStubDomain extends DTManagerTest {
|
|
146
|
-
protected _domain = DomainTest;
|
|
147
|
-
|
|
148
|
-
getDomain(): string {
|
|
149
|
-
return DomainTest;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/** ****************** HELPER METHODS
|
|
154
|
-
* Additional helper methods to use with testing
|
|
155
|
-
* **** */
|
|
156
|
-
// Add mocked bunches and elements to a Manager
|
|
157
|
-
export function populateManager(manager: DTManagerTest): DTManagerTest {
|
|
158
|
-
const mockedElements = generateMockedElements(5);
|
|
159
|
-
|
|
160
|
-
// Library
|
|
161
|
-
manager.th_set_library(new DTBunchStubLibrary(mockedElements));
|
|
162
|
-
|
|
163
|
-
// Scopes
|
|
164
|
-
manager.th_set_scopes(ScopesTest);
|
|
165
|
-
|
|
166
|
-
// Bunches
|
|
167
|
-
const bunch1 = new DTBunchTest();
|
|
168
|
-
bunch1.th_set_items(mockedElements);
|
|
169
|
-
bunch1.th_set_id(bunch1IdTest);
|
|
170
|
-
jest.spyOn(bunch1, 'getId').mockImplementation(() => bunch1IdTest);
|
|
171
|
-
jest.spyOn(bunch1, 'getOptions').mockImplementation(() => ({ ...defaultOptions }));
|
|
172
|
-
jest.spyOn(bunch1, 'getAll').mockImplementation(function () { return this._items; });
|
|
173
|
-
jest.spyOn(bunch1, 'toObject').mockImplementation(() => bunch1toObjectTest);
|
|
174
|
-
|
|
175
|
-
const bunch2 = new DTBunchTest();
|
|
176
|
-
bunch2.th_set_items([]);
|
|
177
|
-
bunch2.th_set_id(bunch2IdTest);
|
|
178
|
-
jest.spyOn(bunch2, 'getId').mockImplementation(() => bunch2IdTest);
|
|
179
|
-
jest.spyOn(bunch2, 'getOptions').mockImplementation(() => ({ ...defaultOptions }));
|
|
180
|
-
jest.spyOn(bunch2, 'getAll').mockImplementation(function () { return this._items; });
|
|
181
|
-
jest.spyOn(bunch2, 'toObject').mockImplementation(() => bunch2toObjectTest);
|
|
182
|
-
|
|
183
|
-
const bunch3 = new DTBunchTest();
|
|
184
|
-
bunch3.th_set_items([]);
|
|
185
|
-
bunch3.th_set_id(bunch3IdTest);
|
|
186
|
-
bunch3.th_set_options({ virtualContainer: true });
|
|
187
|
-
jest.spyOn(bunch3, 'getId').mockImplementation(() => bunch3IdTest);
|
|
188
|
-
jest.spyOn(bunch3, 'getOptions').mockImplementation(() => ({ ...defaultOptions, virtualContainer: true }));
|
|
189
|
-
jest.spyOn(bunch3, 'getAll').mockImplementation(function () { return this._items; });
|
|
190
|
-
jest.spyOn(bunch3, 'toObject').mockImplementation(() => bunch3toObjectTest);
|
|
191
|
-
|
|
192
|
-
const items: DTManagerItemsType<DTElement<DTAcceptedMetaData>> = {
|
|
193
|
-
[bunch1.th_get_id()]: {
|
|
194
|
-
scope: 'default',
|
|
195
|
-
item: bunch1,
|
|
196
|
-
},
|
|
197
|
-
[bunch2.th_get_id()]: {
|
|
198
|
-
scope: ScopesTest[0],
|
|
199
|
-
item: bunch2,
|
|
200
|
-
},
|
|
201
|
-
[bunch3.th_get_id()]: {
|
|
202
|
-
scope: 'virtual',
|
|
203
|
-
item: bunch3,
|
|
204
|
-
},
|
|
205
|
-
};
|
|
206
|
-
manager.th_set_items(items);
|
|
207
|
-
|
|
208
|
-
return manager;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
export const checkManagerItem = (managerTest: DTManagerTest, bunchId: string, scope: string): void => {
|
|
212
|
-
expect(managerTest.th_get_single_item(bunchId)).toBeDefined();
|
|
213
|
-
expect(Object.keys(managerTest.th_get_single_item(bunchId))).toStrictEqual(['scope', 'item']);
|
|
214
|
-
expect(managerTest.th_get_single_item(bunchId).scope).toBe(scope);
|
|
215
|
-
expect(managerTest.th_get_single_item(bunchId).item.th_get_id()).toBe(bunchId);
|
|
216
|
-
};
|