dyo-tools 0.1.0 → 0.3.0
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/.c8rc.json +4 -0
- package/.eslintignore +2 -0
- package/.eslintrc.json +47 -0
- package/Makefile +34 -0
- package/README.md +0 -7
- package/babel.config.js +1 -0
- package/cucumber-report.html +48 -0
- package/dist/constants.d.ts +6 -0
- package/dist/constants.js +63 -0
- package/dist/constants.js.map +1 -0
- package/dist/core/DTAction.d.ts +10 -0
- package/dist/core/DTAction.js +24 -0
- package/dist/core/DTAction.js.map +1 -0
- package/dist/core/DTBunch.d.ts +12 -17
- package/dist/core/DTBunch.js +39 -115
- package/dist/core/DTBunch.js.map +1 -1
- package/dist/core/DTComponent.d.ts +13 -5
- package/dist/core/DTComponent.js +39 -1
- package/dist/core/DTComponent.js.map +1 -1
- package/dist/core/DTComponentPhysical.d.ts +12 -0
- package/dist/core/DTComponentPhysical.js +22 -0
- package/dist/core/DTComponentPhysical.js.map +1 -0
- package/dist/core/DTComponentWithMeta.d.ts +2 -2
- package/dist/core/DTComponentWithMeta.js.map +1 -1
- package/dist/core/DTElement.d.ts +7 -7
- package/dist/core/DTElement.js +12 -11
- package/dist/core/DTElement.js.map +1 -1
- package/dist/core/DTManager.d.ts +33 -0
- package/dist/core/DTManager.js +190 -0
- package/dist/core/DTManager.js.map +1 -0
- package/dist/core/DTMaster.d.ts +24 -0
- package/dist/core/DTMaster.js +133 -0
- package/dist/core/DTMaster.js.map +1 -0
- package/dist/core/DTModule.d.ts +14 -0
- package/dist/core/DTModule.js +39 -0
- package/dist/core/DTModule.js.map +1 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/libs/DYOFinder.d.ts +10 -0
- package/dist/libs/DYOFinder.js +96 -0
- package/dist/libs/DYOFinder.js.map +1 -0
- package/dist/libs/player/DTPlayer.element.d.ts +5 -0
- package/dist/libs/player/DTPlayer.element.js +11 -0
- package/dist/libs/player/DTPlayer.element.js.map +1 -0
- package/dist/libs/player/DTPlayer.manager.d.ts +11 -0
- package/dist/libs/player/DTPlayer.manager.js +42 -0
- package/dist/libs/player/DTPlayer.manager.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1321
- package/dist/types/core.d.ts +103 -0
- package/dist/types/core.js +15 -0
- package/dist/types/core.js.map +1 -0
- package/dist/types/index.d.ts +2 -58
- package/dist/types/index.js +16 -12
- package/dist/types/index.js.map +1 -1
- package/dist/types/player.d.ts +5 -0
- package/dist/types/player.js +3 -0
- package/dist/types/player.js.map +1 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +29 -0
- package/docs/assets/main.js +59 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1414 -0
- package/docs/classes/core_DTAction.DYOToolsAction.html +89 -0
- package/docs/classes/core_DTBunch.DYOToolsBunch.html +254 -0
- package/docs/classes/core_DTComponent.DYOToolsComponent.html +76 -0
- package/docs/classes/core_DTComponentPhysical.DYOToolsComponentPhysical.html +110 -0
- package/docs/classes/core_DTComponentWithMeta.DYOToolsComponentWithMeta.html +96 -0
- package/docs/classes/core_DTElement.DYOToolsElement.html +135 -0
- package/docs/classes/core_DTError.DYOToolsError.html +37 -0
- package/docs/classes/core_DTManager.DYOToolsManager.html +237 -0
- package/docs/classes/core_DTMaster.DYOToolsMaster.html +150 -0
- package/docs/classes/core_DTModule.DYOToolsModule.html +92 -0
- package/docs/classes/libs_DYOFinder.DYOFinder.html +34 -0
- package/docs/classes/libs_player_DTPlayer_element.DYOToolsPlayer.html +134 -0
- package/docs/classes/libs_player_DTPlayer_manager.DYOToolsPlayerManager.html +243 -0
- package/docs/enums/types_core.FilterOperatorType.html +10 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +1 -0
- package/docs/interfaces/types_core.DTBunchFilters.html +6 -0
- package/docs/interfaces/types_core.DTBunchOptions.html +19 -0
- package/docs/interfaces/types_core.DTBunchToObject.html +7 -0
- package/docs/interfaces/types_core.DTComponentOptions.html +5 -0
- package/docs/interfaces/types_core.DTComponentToObject.html +4 -0
- package/docs/interfaces/types_core.DTElementToObject.html +7 -0
- package/docs/interfaces/types_core.DTManagerFilters.html +6 -0
- package/docs/interfaces/types_core.DTManagerOptions.html +8 -0
- package/docs/interfaces/types_core.DTManagerToObject.html +5 -0
- package/docs/interfaces/types_core.DTMasterToObject.html +8 -0
- package/docs/interfaces/types_core.DTModuleToObject.html +6 -0
- package/docs/interfaces/types_core.DYOFinderConfigurationPropDefault.html +4 -0
- package/docs/interfaces/types_core.DYOFinderConfigurationPropObjectSearch.html +4 -0
- package/docs/interfaces/types_core.DYOFinderFilterOperatorAdvanced.html +5 -0
- package/docs/interfaces/types_core.DYOFinderFilterOperatorBase.html +5 -0
- package/docs/interfaces/types_player.DTPlayerManagerSimpleConfiguration.html +3 -0
- package/docs/modules/constants.html +6 -0
- package/docs/modules/core_DTAction.html +2 -0
- package/docs/modules/core_DTBunch.html +2 -0
- package/docs/modules/core_DTComponent.html +2 -0
- package/docs/modules/core_DTComponentPhysical.html +2 -0
- package/docs/modules/core_DTComponentWithMeta.html +2 -0
- package/docs/modules/core_DTElement.html +2 -0
- package/docs/modules/core_DTError.html +2 -0
- package/docs/modules/core_DTManager.html +2 -0
- package/docs/modules/core_DTMaster.html +2 -0
- package/docs/modules/core_DTModule.html +2 -0
- package/docs/modules/libs_DYOFinder.html +2 -0
- package/docs/modules/libs_player_DTPlayer_element.html +2 -0
- package/docs/modules/libs_player_DTPlayer_manager.html +2 -0
- package/docs/modules/types.html +29 -0
- package/docs/modules/types_core.html +28 -0
- package/docs/modules/types_player.html +2 -0
- package/docs/types/types_core.DTAcceptedMetaData.html +2 -0
- package/docs/types/types_core.DTManagerItemType.html +1 -0
- package/docs/types/types_core.DTManagerItemsType.html +2 -0
- package/docs/types/types_core.DYOFinderComponentType.html +1 -0
- package/docs/types/types_core.DYOFinderConfiguration.html +2 -0
- package/docs/types/types_core.DYOFinderConfigurationProp.html +1 -0
- package/docs/types/types_core.DYOFinderFilterOperator.html +1 -0
- package/docs/types/types_core.DYOFinderFilterOperatorArgument.html +1 -0
- package/docs/types/types_core.DYOFinderFilters.html +1 -0
- package/docs/types/types_core.StandardPrimitiveType.html +2 -0
- package/docs/types/types_core.StandardPrimitiveTypeWithArray.html +1 -0
- package/docs/variables/constants.bunchDefaultOptions.html +2 -0
- package/docs/variables/constants.componentBunchDefaultFinderConfiguration.html +1 -0
- package/docs/variables/constants.componentManagerDefaultFinderConfiguration.html +1 -0
- package/docs/variables/constants.componentPhysicalDefaultFinderConfiguration.html +1 -0
- package/docs/variables/constants.managerDefaultOptions.html +2 -0
- package/jest.config.js +6 -0
- package/package.json +32 -23
- package/src/constants.ts +85 -0
- package/src/core/DTAction.ts +52 -0
- package/src/core/DTBunch.ts +467 -0
- package/src/core/DTComponent.ts +225 -0
- package/src/core/DTComponentPhysical.ts +53 -0
- package/src/core/DTComponentWithMeta.ts +65 -0
- package/src/core/DTElement.ts +102 -0
- package/src/core/DTError.ts +78 -0
- package/src/core/DTManager.ts +465 -0
- package/src/core/DTMaster.ts +318 -0
- package/src/core/DTModule.ts +90 -0
- package/src/index.ts +17 -0
- package/src/libs/DYOFinder.ts +175 -0
- package/src/libs/player/DTPlayer.element.ts +9 -0
- package/src/libs/player/DTPlayer.manager.ts +84 -0
- package/src/types/core.ts +169 -0
- package/src/types/index.ts +2 -0
- package/src/types/player.ts +6 -0
- package/test/core/DTAction.double.ts +78 -0
- package/test/core/DTAction.spec.ts +76 -0
- package/test/core/DTBunch.double.ts +261 -0
- package/test/core/DTBunch.spec.ts +897 -0
- package/test/core/DTComponent.double.ts +164 -0
- package/test/core/DTComponent.spec.ts +295 -0
- package/test/core/DTComponentPhysical.double.ts +76 -0
- package/test/core/DTComponentPhysical.spec.ts +78 -0
- package/test/core/DTComponentWithMeta.double.ts +115 -0
- package/test/core/DTComponentWithMeta.spec.ts +124 -0
- package/test/core/DTElement.double.ts +163 -0
- package/test/core/DTElement.spec.ts +146 -0
- package/test/core/DTError.double.ts +92 -0
- package/test/core/DTError.spec.ts +89 -0
- package/test/core/DTManager.double.ts +216 -0
- package/test/core/DTManager.spec.ts +965 -0
- package/test/core/DTMaster.double.ts +141 -0
- package/test/core/DTMaster.spec.ts +584 -0
- package/test/core/DTModule.double.ts +80 -0
- package/test/core/DTModule.spec.ts +138 -0
- package/test/core/copy.spec.ts +243 -0
- package/test/libs/DYOFinder.double.ts +152 -0
- package/test/libs/DYOFinder.spec.ts +194 -0
- package/test/libs/player/DTPlayer.element.double.ts +55 -0
- package/test/libs/player/DTPlayer.element.spec.ts +28 -0
- package/test/libs/player/DTPlayer.manager.double.ts +92 -0
- package/test/libs/player/DTPlayer.manager.spec.ts +178 -0
- package/tsconfig.dev.json +22 -0
- package/tsconfig.json +21 -0
- package/dist/core/DTPlayer.d.ts +0 -8
- package/dist/core/DTPlayer.js +0 -30
- package/dist/core/DTPlayer.js.map +0 -1
- package/dist/utils/filters.d.ts +0 -6
- package/dist/utils/filters.js +0 -39
- package/dist/utils/filters.js.map +0 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import {expect, jest} from "@jest/globals";
|
|
2
|
+
import {DTAction, DTManager, DTMaster, DTModule} from "../../src";
|
|
3
|
+
import {DTManagerStub, IDTest as IDManagerTest, manager1IDTest, manager1KeyTest} from "./DTManager.double";
|
|
4
|
+
import {DTActionStub, IDTest as IDActionTest, action1IDTest, action1KeyTest} from "./DTAction.double";
|
|
5
|
+
import {DTModuleStub, IDTest as IDModuleTest, module1IDTest, module1KeyTest} from "./DTModule.double";
|
|
6
|
+
|
|
7
|
+
/** ****************** STUB PROPERTIES CONSTANTS
|
|
8
|
+
* Fixed properties to use with double classes, avoid auto generated and easy checking on test
|
|
9
|
+
* **** */
|
|
10
|
+
export const IDTest = 'DTMaster-id-1234567';
|
|
11
|
+
export const KeyTest = 'DTMaster-key-1234567';
|
|
12
|
+
|
|
13
|
+
/** ****************** HELPER TEST CLASS
|
|
14
|
+
* Helper test class, inherits the main component
|
|
15
|
+
* Providing methods to property access and other facilities, in order to avoid using class methods
|
|
16
|
+
* **** */
|
|
17
|
+
export class DTMasterTest extends DTMaster {
|
|
18
|
+
th_get_id(): string {
|
|
19
|
+
return this._id;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
th_set_id(id: string): void {
|
|
23
|
+
this._id = id;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
th_get_key(): string {
|
|
27
|
+
return this._key;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
th_set_key(key: string): void {
|
|
31
|
+
this._key = key;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
th_get_componentType(): string {
|
|
35
|
+
return this._componentType;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
th_get_managers(): Record<string, DTManager<any>> {
|
|
39
|
+
return this._managers;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
th_set_managers(managers: Record<string, DTManager<any>>): void {
|
|
43
|
+
this._managers = managers;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
th_get_actions(): Record<string, DTAction> {
|
|
47
|
+
return this._actions;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
th_set_actions(actions: Record<string, DTAction>): void {
|
|
51
|
+
this._actions = actions;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
th_get_modules(): Record<string, DTModule> {
|
|
55
|
+
return this._modules;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
th_set_modules(modules: Record<string, DTModule>): void {
|
|
59
|
+
this._modules = modules;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
/** ****************** STUB CLASS
|
|
65
|
+
* Stub class, for using in other component
|
|
66
|
+
* **** */
|
|
67
|
+
|
|
68
|
+
/** ****************** HELPER METHODS
|
|
69
|
+
* Additional helper methods to use with testing
|
|
70
|
+
* **** */
|
|
71
|
+
export const checkMasterManagers = (master: DTMasterTest, ids: string[]) => {
|
|
72
|
+
let i = 0;
|
|
73
|
+
expect(Object.keys(master.th_get_managers()).length).toBe(ids.length);
|
|
74
|
+
for (let [id, manager] of Object.entries(master.th_get_managers())) {
|
|
75
|
+
expect(id).toBe(ids[i]);
|
|
76
|
+
expect(manager.getId()).toBe(ids[i]);
|
|
77
|
+
i++;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export const checkMasterActions = (master: DTMasterTest, ids: string[]) => {
|
|
82
|
+
let i = 0;
|
|
83
|
+
expect(Object.keys(master.th_get_actions()).length).toBe(ids.length);
|
|
84
|
+
for (let [id, action] of Object.entries(master.th_get_actions())) {
|
|
85
|
+
expect(id).toBe(ids[i]);
|
|
86
|
+
expect(action.getId()).toBe(ids[i]);
|
|
87
|
+
i++;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export const checkMasterModules = (master: DTMasterTest, ids: string[]) => {
|
|
92
|
+
let i = 0;
|
|
93
|
+
expect(Object.keys(master.th_get_modules()).length).toBe(ids.length);
|
|
94
|
+
for (let [id, module] of Object.entries(master.th_get_modules())) {
|
|
95
|
+
expect(id).toBe(ids[i]);
|
|
96
|
+
expect(module.getId()).toBe(ids[i]);
|
|
97
|
+
i++;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const populateMaster = (master: DTMasterTest) => {
|
|
102
|
+
// Managers
|
|
103
|
+
const manager1 = new DTManagerStub();
|
|
104
|
+
const manager2 = new DTManagerStub();
|
|
105
|
+
manager2.th_set_id(manager1IDTest);
|
|
106
|
+
manager2.th_set_key(manager1KeyTest);
|
|
107
|
+
jest.spyOn(manager2, 'getId').mockReturnValue(manager1IDTest);
|
|
108
|
+
jest.spyOn(manager2, 'getKey').mockReturnValue(manager1KeyTest);
|
|
109
|
+
|
|
110
|
+
master.th_set_managers({
|
|
111
|
+
[IDManagerTest]: manager1,
|
|
112
|
+
[manager1IDTest]: manager2
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// Actions
|
|
116
|
+
const action1 = new DTActionStub();
|
|
117
|
+
const action2 = new DTActionStub();
|
|
118
|
+
action2.th_set_id(action1IDTest);
|
|
119
|
+
action2.th_set_key(action1KeyTest);
|
|
120
|
+
jest.spyOn(action2, 'getId').mockReturnValue(action1IDTest);
|
|
121
|
+
jest.spyOn(action2, 'getKey').mockReturnValue(action1KeyTest);
|
|
122
|
+
|
|
123
|
+
master.th_set_actions({
|
|
124
|
+
[IDActionTest]: action1,
|
|
125
|
+
[action1IDTest]: action2
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// Modules
|
|
129
|
+
const module1 = new DTModuleStub();
|
|
130
|
+
const module2 = new DTModuleStub();
|
|
131
|
+
module2.th_set_id(module1IDTest);
|
|
132
|
+
module2.th_set_key(module1KeyTest);
|
|
133
|
+
module2.th_set_enabled(false);
|
|
134
|
+
jest.spyOn(module2, 'getId').mockReturnValue(module1IDTest);
|
|
135
|
+
jest.spyOn(module2, 'getKey').mockReturnValue(module1KeyTest);
|
|
136
|
+
|
|
137
|
+
master.th_set_modules({
|
|
138
|
+
[IDModuleTest]: module1,
|
|
139
|
+
[module1IDTest]: module2
|
|
140
|
+
});
|
|
141
|
+
}
|