dyo-tools 0.2.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.
Files changed (167) hide show
  1. package/dist/constants.js +4 -4
  2. package/dist/constants.js.map +1 -1
  3. package/dist/core/DTAction.d.ts +10 -0
  4. package/dist/core/DTAction.js +24 -0
  5. package/dist/core/DTAction.js.map +1 -0
  6. package/dist/core/DTBunch.d.ts +6 -7
  7. package/dist/core/DTBunch.js +16 -13
  8. package/dist/core/DTBunch.js.map +1 -1
  9. package/dist/core/DTComponentPhysical.d.ts +6 -4
  10. package/dist/core/DTComponentPhysical.js +6 -0
  11. package/dist/core/DTComponentPhysical.js.map +1 -1
  12. package/dist/core/DTElement.d.ts +5 -0
  13. package/dist/core/DTElement.js +12 -2
  14. package/dist/core/DTElement.js.map +1 -1
  15. package/dist/core/DTManager.d.ts +3 -1
  16. package/dist/core/DTManager.js +24 -14
  17. package/dist/core/DTManager.js.map +1 -1
  18. package/dist/core/DTMaster.d.ts +24 -0
  19. package/dist/core/DTMaster.js +133 -0
  20. package/dist/core/DTMaster.js.map +1 -0
  21. package/dist/core/DTModule.d.ts +14 -0
  22. package/dist/core/DTModule.js +39 -0
  23. package/dist/core/DTModule.js.map +1 -0
  24. package/dist/index.d.ts +5 -1
  25. package/dist/index.js +11 -3
  26. package/dist/index.js.map +1 -1
  27. package/dist/libs/player/DTPlayer.element.d.ts +5 -0
  28. package/dist/libs/player/DTPlayer.element.js +11 -0
  29. package/dist/libs/player/DTPlayer.element.js.map +1 -0
  30. package/dist/libs/player/DTPlayer.manager.d.ts +11 -0
  31. package/dist/libs/player/DTPlayer.manager.js +42 -0
  32. package/dist/libs/player/DTPlayer.manager.js.map +1 -0
  33. package/dist/tsconfig.tsbuildinfo +1 -1
  34. package/dist/types/core.d.ts +103 -0
  35. package/dist/types/core.js +15 -0
  36. package/dist/types/core.js.map +1 -0
  37. package/dist/types/index.d.ts +2 -98
  38. package/dist/types/index.js +16 -12
  39. package/dist/types/index.js.map +1 -1
  40. package/dist/types/player.d.ts +5 -0
  41. package/dist/types/player.js +3 -0
  42. package/dist/types/player.js.map +1 -0
  43. package/docs/assets/highlight.css +29 -29
  44. package/docs/assets/main.js +59 -58
  45. package/docs/assets/navigation.js +1 -0
  46. package/docs/assets/search.js +1 -1
  47. package/docs/assets/style.css +1414 -1367
  48. package/docs/classes/core_DTAction.DYOToolsAction.html +89 -0
  49. package/docs/classes/core_DTBunch.DYOToolsBunch.html +254 -0
  50. package/docs/classes/core_DTComponent.DYOToolsComponent.html +76 -0
  51. package/docs/classes/core_DTComponentPhysical.DYOToolsComponentPhysical.html +110 -0
  52. package/docs/classes/core_DTComponentWithMeta.DYOToolsComponentWithMeta.html +96 -0
  53. package/docs/classes/core_DTElement.DYOToolsElement.html +135 -0
  54. package/docs/classes/core_DTError.DYOToolsError.html +37 -0
  55. package/docs/classes/core_DTManager.DYOToolsManager.html +237 -0
  56. package/docs/classes/core_DTMaster.DYOToolsMaster.html +150 -0
  57. package/docs/classes/core_DTModule.DYOToolsModule.html +92 -0
  58. package/docs/classes/libs_DYOFinder.DYOFinder.html +34 -0
  59. package/docs/classes/libs_player_DTPlayer_element.DYOToolsPlayer.html +134 -0
  60. package/docs/classes/libs_player_DTPlayer_manager.DYOToolsPlayerManager.html +243 -0
  61. package/docs/enums/types_core.FilterOperatorType.html +10 -0
  62. package/docs/hierarchy.html +1 -0
  63. package/docs/index.html +1 -46
  64. package/docs/interfaces/types_core.DTBunchFilters.html +6 -0
  65. package/docs/interfaces/types_core.DTBunchOptions.html +19 -0
  66. package/docs/interfaces/types_core.DTBunchToObject.html +7 -0
  67. package/docs/interfaces/types_core.DTComponentOptions.html +5 -0
  68. package/docs/interfaces/types_core.DTComponentToObject.html +4 -0
  69. package/docs/interfaces/types_core.DTElementToObject.html +7 -0
  70. package/docs/interfaces/types_core.DTManagerFilters.html +6 -0
  71. package/docs/interfaces/types_core.DTManagerOptions.html +8 -0
  72. package/docs/interfaces/types_core.DTManagerToObject.html +5 -0
  73. package/docs/interfaces/types_core.DTMasterToObject.html +8 -0
  74. package/docs/interfaces/types_core.DTModuleToObject.html +6 -0
  75. package/docs/interfaces/types_core.DYOFinderConfigurationPropDefault.html +4 -0
  76. package/docs/interfaces/types_core.DYOFinderConfigurationPropObjectSearch.html +4 -0
  77. package/docs/interfaces/types_core.DYOFinderFilterOperatorAdvanced.html +5 -0
  78. package/docs/interfaces/types_core.DYOFinderFilterOperatorBase.html +5 -0
  79. package/docs/interfaces/types_player.DTPlayerManagerSimpleConfiguration.html +3 -0
  80. package/docs/modules/constants.html +6 -0
  81. package/docs/modules/core_DTAction.html +2 -0
  82. package/docs/modules/core_DTBunch.html +2 -0
  83. package/docs/modules/core_DTComponent.html +2 -0
  84. package/docs/modules/core_DTComponentPhysical.html +2 -0
  85. package/docs/modules/core_DTComponentWithMeta.html +2 -0
  86. package/docs/modules/core_DTElement.html +2 -0
  87. package/docs/modules/core_DTError.html +2 -0
  88. package/docs/modules/core_DTManager.html +2 -0
  89. package/docs/modules/core_DTMaster.html +2 -0
  90. package/docs/modules/core_DTModule.html +2 -0
  91. package/docs/modules/libs_DYOFinder.html +2 -0
  92. package/docs/modules/libs_player_DTPlayer_element.html +2 -0
  93. package/docs/modules/libs_player_DTPlayer_manager.html +2 -0
  94. package/docs/modules/types.html +29 -0
  95. package/docs/modules/types_core.html +28 -0
  96. package/docs/modules/types_player.html +2 -0
  97. package/docs/types/types_core.DTAcceptedMetaData.html +2 -0
  98. package/docs/types/types_core.DTManagerItemType.html +1 -0
  99. package/docs/types/types_core.DTManagerItemsType.html +2 -0
  100. package/docs/types/types_core.DYOFinderComponentType.html +1 -0
  101. package/docs/types/types_core.DYOFinderConfiguration.html +2 -0
  102. package/docs/types/types_core.DYOFinderConfigurationProp.html +1 -0
  103. package/docs/types/types_core.DYOFinderFilterOperator.html +1 -0
  104. package/docs/types/types_core.DYOFinderFilterOperatorArgument.html +1 -0
  105. package/docs/types/types_core.DYOFinderFilters.html +1 -0
  106. package/docs/types/types_core.StandardPrimitiveType.html +2 -0
  107. package/docs/types/types_core.StandardPrimitiveTypeWithArray.html +1 -0
  108. package/docs/variables/constants.bunchDefaultOptions.html +2 -0
  109. package/docs/variables/constants.componentBunchDefaultFinderConfiguration.html +1 -0
  110. package/docs/variables/constants.componentManagerDefaultFinderConfiguration.html +1 -0
  111. package/docs/variables/constants.componentPhysicalDefaultFinderConfiguration.html +1 -0
  112. package/docs/variables/constants.managerDefaultOptions.html +2 -0
  113. package/package.json +16 -17
  114. package/src/constants.ts +85 -85
  115. package/src/core/DTAction.ts +52 -0
  116. package/src/core/DTBunch.ts +467 -461
  117. package/src/core/DTComponent.ts +225 -225
  118. package/src/core/DTComponentPhysical.ts +53 -39
  119. package/src/core/DTComponentWithMeta.ts +65 -65
  120. package/src/core/DTElement.ts +102 -69
  121. package/src/core/DTError.ts +78 -78
  122. package/src/core/DTManager.ts +465 -446
  123. package/src/core/DTMaster.ts +318 -0
  124. package/src/core/DTModule.ts +90 -0
  125. package/src/index.ts +17 -9
  126. package/src/libs/DYOFinder.ts +175 -175
  127. package/src/libs/player/DTPlayer.element.ts +9 -0
  128. package/src/libs/player/DTPlayer.manager.ts +84 -0
  129. package/src/types/core.ts +169 -0
  130. package/src/types/index.ts +2 -162
  131. package/src/types/player.ts +6 -0
  132. package/test/core/DTAction.double.ts +78 -0
  133. package/test/core/DTAction.spec.ts +76 -0
  134. package/test/core/DTBunch.double.ts +18 -10
  135. package/test/core/DTBunch.spec.ts +70 -68
  136. package/test/core/DTComponentPhysical.double.ts +3 -3
  137. package/test/core/DTComponentPhysical.spec.ts +25 -11
  138. package/test/core/DTElement.double.ts +21 -5
  139. package/test/core/DTElement.spec.ts +52 -8
  140. package/test/core/DTError.double.ts +1 -1
  141. package/test/core/DTManager.double.ts +29 -5
  142. package/test/core/DTManager.spec.ts +80 -17
  143. package/test/core/DTMaster.double.ts +141 -0
  144. package/test/core/DTMaster.spec.ts +584 -0
  145. package/test/core/DTModule.double.ts +80 -0
  146. package/test/core/DTModule.spec.ts +138 -0
  147. package/test/core/copy.spec.ts +20 -4
  148. package/test/{core/DTPlayer.double.ts → libs/player/DTPlayer.element.double.ts} +15 -24
  149. package/test/libs/player/DTPlayer.element.spec.ts +28 -0
  150. package/test/libs/player/DTPlayer.manager.double.ts +92 -0
  151. package/test/libs/player/DTPlayer.manager.spec.ts +178 -0
  152. package/LICENSE +0 -21
  153. package/cucumber.js +0 -9
  154. package/dist/core/DTPlayer.d.ts +0 -8
  155. package/dist/core/DTPlayer.js +0 -30
  156. package/dist/core/DTPlayer.js.map +0 -1
  157. package/e2e/0.2.0/epic1.feature +0 -29
  158. package/e2e/0.2.0/epic2.feature +0 -22
  159. package/e2e/0.2.0/epic3.feature +0 -25
  160. package/e2e/0.2.0/resources/dominion.js +0 -195
  161. package/e2e/0.2.0/resources/utils.js +0 -27
  162. package/e2e/0.2.0/support/steps.js +0 -108
  163. package/e2e/future/epic4.feature +0 -39
  164. package/e2e/future/resources/dominion.js +0 -238
  165. package/e2e/future/resources/utils.js +0 -27
  166. package/src/core/DTPlayer.ts +0 -57
  167. package/test/core/DTPlayer.spec.ts +0 -80
@@ -1,162 +1,2 @@
1
- import { DTBunch, DTComponent } from '../index';
2
- import DYOToolsElement from '../core/DTElement';
3
-
4
- /** Constants Enum * */
5
- export enum FilterOperatorType {
6
- EQ = '$eq',
7
- IN = '$in',
8
- NIN = '$nin',
9
- NE = '$ne',
10
- LTE = '$lte',
11
- GTE = '$gte',
12
- CONTAINS = '$contains',
13
- NCONTAINS = '$ncontains',
14
- }
15
-
16
- /** Common Types * */
17
- export type StandardPrimitiveType = string | number | boolean | null | undefined;
18
- export type StandardPrimitiveTypeWithArray = string | number | boolean | Array<string | number | boolean> | null | undefined;
19
-
20
- /** DYO Finder interfaces * */
21
- export type DYOFinderConfiguration = Record<string, DYOFinderConfigurationProp>;
22
- export type DYOFinderComponentType = DTComponent & {
23
- getAll: () => DTComponent[],
24
- };
25
-
26
- export interface DYOFinderConfigurationPropDefault {
27
- operators: FilterOperatorType[],
28
- getValue: (item: DTComponent, ctx?: DTComponent) => StandardPrimitiveType,
29
- objectSearch: false,
30
- }
31
-
32
- export interface DYOFinderConfigurationPropObjectSearch {
33
- operators: FilterOperatorType[],
34
- getValue: (item: DTComponent, ctx?: DTComponent) => Record<string, StandardPrimitiveTypeWithArray>,
35
- objectSearch: true,
36
- }
37
- export type DYOFinderConfigurationProp = DYOFinderConfigurationPropDefault | DYOFinderConfigurationPropObjectSearch;
38
-
39
- export interface DYOFinderFilterOperatorBase {
40
- [FilterOperatorType.EQ]: StandardPrimitiveType
41
- [FilterOperatorType.IN]: Array<StandardPrimitiveType>
42
- [FilterOperatorType.NIN]: Array<StandardPrimitiveType>
43
- [FilterOperatorType.NE]: StandardPrimitiveType
44
- }
45
- export interface DYOFinderFilterOperatorAdvanced {
46
- [FilterOperatorType.LTE]: number
47
- [FilterOperatorType.GTE]: number
48
- [FilterOperatorType.CONTAINS]: StandardPrimitiveType
49
- [FilterOperatorType.NCONTAINS]: StandardPrimitiveType
50
- }
51
-
52
- export type DYOFinderFilterOperator = DYOFinderFilterOperatorBase & DYOFinderFilterOperatorAdvanced;
53
- export type DYOFinderFilterOperatorArgument = Partial<DYOFinderFilterOperator | Record<string, Partial<DYOFinderFilterOperator>>>;
54
- export type DYOFinderFilters = Record<string, DYOFinderFilterOperatorArgument>;
55
-
56
- /** DTComponent interfaces * */
57
- /**
58
- * DTComponent default options configuration.
59
- */
60
- export interface DTComponentOptions {
61
- /**
62
- * Default *false*. If *true*, no exception is thrown when an error occurred, a new DTError instance is
63
- * added to the _errors property array instead. If *false*, throw the exception with a DTError instance.
64
- */
65
- errors: boolean
66
- }
67
-
68
- export interface DTComponentToObject {
69
- id: string
70
- key: string
71
- type: string
72
- }
73
-
74
- /** DTComponentWithMeta interfaces * */
75
- export type DTAcceptedMetaData = Record<
76
- string,
77
- StandardPrimitiveTypeWithArray
78
- >;
79
-
80
- /** DTElement interfaces * */
81
- export interface DTElementToObject<IComponentMeta> extends DTComponentToObject {
82
- owner?: string
83
- meta?: Partial<IComponentMeta>
84
- }
85
-
86
- /** DTBunch interfaces * */
87
- /**
88
- * DTBunch option configuration.
89
- */
90
- export interface DTBunchOptions extends DTComponentOptions {
91
- /**
92
- * Default *false*. If *true*, an error occurred when adding a new DTElement with the same key of an
93
- * existing element into the bunch.
94
- */
95
- uniqueKey: boolean
96
- /**
97
- * Default *false*. If *true*, when a new DTElement is added, the owner of this element becomes
98
- * automatically the current bunch owner.
99
- */
100
- replaceIndex: boolean
101
- /**
102
- * Default *false*. If *true*, the context is not changed when a new DTElement is added.
103
- * If *false*, when a new DTElement is added, the context of this element becomes automatically the current bunch instance
104
- * and the element is removed from the old context Component (if defined).
105
- */
106
- inheritOwner: boolean
107
- /**
108
- * Default *false*. If *true*, when a new DTElement is added at existing index (using **addAtIndex**
109
- * or **addManyAtIndex** method), this component replaces the old one. If *false*, this component is added at the specified
110
- * index and other existing component are reindexed with the following index.
111
- */
112
- virtualContext: boolean
113
- }
114
-
115
- export interface DTBunchToObject<IComponentMeta> extends DTComponentToObject {
116
- items: Array<DTElementToObject<DTAcceptedMetaData>>
117
- owner?: string
118
- meta?: Partial<IComponentMeta>
119
- }
120
-
121
- export interface DTBunchFilters {
122
- id: Partial<DYOFinderFilterOperatorBase>
123
- key: Partial<DYOFinderFilterOperatorBase>
124
- context: Partial<DYOFinderFilterOperatorBase>
125
- owner: Partial<DYOFinderFilterOperatorBase>
126
- meta: Record<string, Partial<DYOFinderFilterOperatorAdvanced>>
127
- }
128
-
129
- /** DTPlayer interfaces * */
130
- export interface DTPlayerToObject<IComponentMeta> extends DTComponentToObject {
131
- meta?: Partial<IComponentMeta>
132
- }
133
-
134
- /** DTManager interfaces * */
135
- export type DTManagerItemsType<IBunchItem extends DYOToolsElement<DTAcceptedMetaData>> = Record<string, DTManagerItemType<IBunchItem>>;
136
- export type DTManagerItemType<IBunchItem extends DYOToolsElement<DTAcceptedMetaData>> = {
137
- scope: string,
138
- item: DTBunch<IBunchItem>,
139
- };
140
-
141
- export interface DTManagerFilters extends DYOFinderFilters {
142
- id: Partial<DYOFinderFilterOperatorBase>
143
- key: Partial<DYOFinderFilterOperatorBase>
144
- owner: Partial<DYOFinderFilterOperatorBase>
145
- scope: Partial<DYOFinderFilterOperatorBase>
146
- meta: Record<string, Partial<DYOFinderFilterOperatorAdvanced>>
147
- }
148
-
149
- /**
150
- * DTManager option configuration.
151
- */
152
- export interface DTManagerOptions extends DTComponentOptions {
153
- /**
154
- * Default *false*. If *true*, when a bunch instance is removed from the Manager _items, the process performs also
155
- * a removal from the Manager Library of all DTElement instances of the bunch.
156
- */
157
- libraryDeletion: boolean,
158
- }
159
-
160
- export interface DTManagerToObject extends DTComponentToObject {
161
- items: Array<DTBunchToObject<DTAcceptedMetaData> & { scope: string }>
162
- }
1
+ export * from './core';
2
+ export * from './player';
@@ -0,0 +1,6 @@
1
+ import { DTPlayer } from '../index';
2
+
3
+ export interface DTPlayerManagerSimpleConfiguration {
4
+ players?: number | DTPlayer[];
5
+ errors?: boolean;
6
+ }
@@ -0,0 +1,78 @@
1
+ import {DTAction} from "../../src";
2
+ import {DTComponentToObject} from "../../src/types";
3
+
4
+ /** ****************** STUB PROPERTIES CONSTANTS
5
+ * Fixed properties to use with double classes, avoid auto generated and easy checking on test
6
+ * **** */
7
+ export const IDTest = 'DTAction-id-1234567';
8
+ export const KeyTest = 'DTAction-key-1234567';
9
+
10
+ // Specific Manager constants
11
+ export const action1IDTest = `${IDTest}_1`;
12
+ export const action1KeyTest = `${KeyTest}_1`;
13
+
14
+ export const action1ToObject: DTComponentToObject = {
15
+ id: action1IDTest,
16
+ key: action1KeyTest,
17
+ type: 'action'
18
+ }
19
+
20
+ /******************** STUB ABSTRACT IMPLEMENTATION
21
+ * Implementation of abstract component class for tests
22
+ * *****/
23
+ export class DTActionImpl extends DTAction<string> {
24
+ async execute(payload: string): Promise<void> {
25
+ throw `${this._key} : ${payload}`;
26
+ }
27
+ }
28
+
29
+ /** ****************** HELPER TEST CLASS
30
+ * Helper test class, inherits the main component
31
+ * Providing methods to property access and other facilities, in order to avoid using class methods
32
+ * **** */
33
+ export class DTActionTest extends DTActionImpl {
34
+ th_get_id(): string {
35
+ return this._id;
36
+ }
37
+
38
+ th_set_id(id: string): void {
39
+ this._id = id;
40
+ }
41
+
42
+ th_get_key(): string {
43
+ return this._key;
44
+ }
45
+
46
+ th_set_key(key: string): void {
47
+ this._key = key;
48
+ }
49
+
50
+ th_get_componentType(): string {
51
+ return this._componentType;
52
+ }
53
+ }
54
+
55
+
56
+ /** ****************** STUB CLASS
57
+ * Stub class, for using in other component
58
+ * **** */
59
+ export class DTActionStub extends DTActionTest {
60
+ constructor() {
61
+ super();
62
+ this._id = IDTest;
63
+ this._key = KeyTest;
64
+ this._errors = [];
65
+ }
66
+
67
+ getId(): string {
68
+ return IDTest;
69
+ }
70
+
71
+ getKey(): string {
72
+ return KeyTest;
73
+ }
74
+ }
75
+
76
+ /** ****************** HELPER METHODS
77
+ * Additional helper methods to use with testing
78
+ * **** */
@@ -0,0 +1,76 @@
1
+ import {DTComponent, DTAction} from "../../src";
2
+ import {mockOverriddenMethods} from "./DTComponent.double";
3
+ import {afterEach, beforeEach, describe, expect, jest, test} from "@jest/globals";
4
+ import {DTActionTest, IDTest, KeyTest} from "./DTAction.double";
5
+
6
+ /** ****************** MOCK DEPENDENCIES
7
+ * Dependencies used by the component are mocked with Jest
8
+ * **** */
9
+ jest.mock('../../src/core/DTComponent');
10
+ jest.mock('../../src/core/DTError');
11
+ // Add specific mock for inherited methods to have a basic implementation
12
+ mockOverriddenMethods(DTComponent);
13
+
14
+ /** *********************** TESTS SUITES ****************************** */
15
+ describe('class DYOToolsAction', () => {
16
+ let actionTest: DTActionTest;
17
+
18
+ beforeEach(() => {
19
+ actionTest = new DTActionTest();
20
+ actionTest.th_set_id(IDTest);
21
+ actionTest.th_set_key(KeyTest);
22
+ });
23
+
24
+ afterEach(() => {
25
+ jest.resetAllMocks();
26
+ });
27
+
28
+ describe('inheritance', () => {
29
+ test('check good inheritance for class', () => {
30
+ expect(DTAction.prototype instanceof DTComponent).toBeTruthy();
31
+ });
32
+ });
33
+
34
+ describe('_componentType', () => {
35
+ test('componentType must be "action"', () => {
36
+ expect(actionTest.th_get_componentType()).toBe('action');
37
+ });
38
+ });
39
+
40
+ describe('getMaster', () => {
41
+ test('call get context with master accessor', () => {
42
+ actionTest.getMaster();
43
+
44
+ expect((actionTest.getContext as any).mock.calls.length).toBe(1);
45
+ expect((actionTest.getContext as any).mock.calls[0][0]).toBe('master');
46
+ });
47
+ });
48
+
49
+ describe('execute', () => {
50
+ test('throw payload in test implementation', async () => {
51
+ const payload = `execute action`;
52
+ const expectedPayload = `${KeyTest} : execute action`;
53
+
54
+ await expect(actionTest.execute(payload)).rejects.toBe(expectedPayload);
55
+ });
56
+ });
57
+
58
+ describe('toString', () => {
59
+ test('string output standard', () => {
60
+ const toStringAction = actionTest.toString();
61
+
62
+ expect(toStringAction).toBe(`Component ${KeyTest} - Type: Action`);
63
+ });
64
+ });
65
+
66
+ describe('toObject', () => {
67
+ test('toObject output standard', () => {
68
+ const toObjectAction: any = actionTest.toObject();
69
+
70
+ expect(Object.keys(toObjectAction)).toStrictEqual(['id', 'key', 'type']);
71
+ expect(toObjectAction.id).toBe(IDTest);
72
+ expect(toObjectAction.key).toBe(KeyTest);
73
+ expect(toObjectAction.type).toBe('action');
74
+ });
75
+ });
76
+ });
@@ -1,5 +1,5 @@
1
- import { DTBunch, DTComponent } from '../../src';
2
- import { bunchDefaultOptions as DTBunchDefaultOptions } from '../../src/constants';
1
+ import {DTBunch, DTComponent} from '../../src';
2
+ import {bunchDefaultOptions as DTBunchDefaultOptions} from '../../src/constants';
3
3
  import {
4
4
  HaileiMetaData,
5
5
  IldressMetaData,
@@ -9,8 +9,7 @@ import {
9
9
  YssaliaMetaData,
10
10
  } from './DTComponentWithMeta.double';
11
11
  import DYOToolsElement from '../../src/core/DTElement';
12
- import { DTBunchOptions, DTElementToObject } from '../../src/types';
13
- import Mocked = jest.Mocked;
12
+ import {DTBunchOptions, DTElementToObject} from '../../src/types';
14
13
  import {
15
14
  HaileiIdTest,
16
15
  HaileiKeyTest,
@@ -23,11 +22,14 @@ import {
23
22
  MaydenaToObjectTest,
24
23
  MeldrineIdTest,
25
24
  MeldrineKeyTest,
26
- MeldrineToObjectTest, YssaliaIdTest, YssaliaKeyTest, YssaliaToObjectTest,
25
+ MeldrineToObjectTest,
26
+ YssaliaIdTest,
27
+ YssaliaKeyTest,
28
+ YssaliaToObjectTest,
27
29
  } from './DTElement.double';
28
- import { DTErrorStub } from './DTError.double';
29
- import { DTPlayerStub } from './DTPlayer.double';
30
+ import {DTErrorStub} from './DTError.double';
30
31
  import DYOFinder from '../../src/libs/DYOFinder';
32
+ import Mocked = jest.Mocked;
31
33
 
32
34
  /** ****************** STUB PROPERTIES CONSTANTS
33
35
  * Fixed properties to use with double classes, avoid auto generated and easy checking on test
@@ -108,11 +110,11 @@ export class DTBunchTest extends DTBunch<Mocked<DYOToolsElement<IMetaDataTest>>,
108
110
  };
109
111
  }
110
112
 
111
- th_get_owner(): DTPlayerStub {
113
+ th_get_owner(): string {
112
114
  return this._owner;
113
115
  }
114
116
 
115
- th_set_owner(owner: DTPlayerStub): void {
117
+ th_set_owner(owner: string): void {
116
118
  this._owner = owner;
117
119
  }
118
120
 
@@ -165,7 +167,7 @@ export class DTBunchStubLibrary extends DTBunchStub {
165
167
  this._items = items;
166
168
  this._options = {
167
169
  ...DTBunchDefaultOptions,
168
- virtualContext: true,
170
+ virtualContainer: true,
169
171
  };
170
172
  }
171
173
 
@@ -243,6 +245,12 @@ export const generateMockedElements = (numberElements: number): Array<Mocked<DYO
243
245
  mockedElement.getOwner.mockImplementation(function () {
244
246
  return this._owner;
245
247
  });
248
+ mockedElement.setContainer.mockImplementation(function (container) {
249
+ this._container = container;
250
+ });
251
+ mockedElement.getContainer.mockImplementation(function () {
252
+ return this._container;
253
+ });
246
254
  mockedElement.copy.mockReturnValue(mockedElement);
247
255
  mockedElement.toObject.mockReturnValue(mockedData[selectedMock].toObject);
248
256