dyo-tools 0.4.0 → 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/index.d.ts → index.d.ts} +1 -0
- package/{dist/index.d.ts.map → index.d.ts.map} +1 -1
- package/{dist/index.js → index.js} +1 -0
- package/package.json +6 -56
- 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/docs/.nojekyll +0 -1
- package/docs/assets/highlight.css +0 -29
- package/docs/assets/main.js +0 -59
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1414
- package/docs/index.html +0 -1
- package/integration/data/components/DTHero.ts +0 -42
- package/integration/data/components/DTHeroManager.ts +0 -11
- package/integration/data/components/DTHeroPlayZone.ts +0 -6
- package/integration/data/components/DTHeroPlayerHand.ts +0 -11
- package/integration/data/components/index.ts +0 -5
- package/integration/data/in/heroIn.helper.ts +0 -8
- package/integration/data/in/playerIn.helper.ts +0 -13
- package/integration/data/out/heroOut.helper.ts +0 -48
- package/integration/endings/synchronisation.ending.ts +0 -25
- package/integration/scenes/drawCard.scene.ts +0 -31
- package/integration/scenes/empty.scene.ts +0 -6
- package/integration/scenes/playCard.scene.ts +0 -23
- package/integration/scenes/playerLeave.scene.ts +0 -33
- package/integration/stages/baseDix.stage.ts +0 -137
- package/integration/stages/syncDix.stage.ts +0 -36
- package/integration/tests/scenario1.spec.ts +0 -55
- package/integration/types/index.ts +0 -24
- package/jest-integration.config.ts +0 -25
- package/jest.config.ts +0 -26
- package/src/constants.ts +0 -87
- package/src/core/DTAction.ts +0 -54
- package/src/core/DTBunch.ts +0 -531
- package/src/core/DTComponent.ts +0 -258
- package/src/core/DTComponentPhysical.ts +0 -88
- package/src/core/DTComponentWithMeta.ts +0 -98
- package/src/core/DTElement.ts +0 -111
- package/src/core/DTError.ts +0 -78
- package/src/core/DTManager.ts +0 -555
- package/src/core/DTMaster.ts +0 -366
- package/src/core/DTModule.ts +0 -96
- package/src/index.ts +0 -17
- package/src/libs/DYOFinder.ts +0 -175
- package/src/libs/dix/DIXModule.module.ts +0 -98
- package/src/libs/player/DTPlayer.element.ts +0 -9
- package/src/libs/player/DTPlayer.manager.ts +0 -70
- package/src/types/core.ts +0 -204
- package/src/types/index.ts +0 -2
- package/src/types/player.ts +0 -5
- package/test/core/DTAction.double.ts +0 -62
- package/test/core/DTAction.spec.ts +0 -68
- package/test/core/DTBunch.double.ts +0 -175
- package/test/core/DTBunch.spec.ts +0 -822
- package/test/core/DTComponent.double.ts +0 -179
- package/test/core/DTComponent.spec.ts +0 -297
- package/test/core/DTComponentPhysical.double.ts +0 -62
- package/test/core/DTComponentPhysical.spec.ts +0 -81
- package/test/core/DTComponentWithMeta.double.ts +0 -122
- package/test/core/DTComponentWithMeta.spec.ts +0 -129
- package/test/core/DTElement.double.ts +0 -142
- package/test/core/DTElement.spec.ts +0 -123
- package/test/core/DTError.double.ts +0 -57
- package/test/core/DTError.spec.ts +0 -78
- package/test/core/DTManager.double.ts +0 -149
- package/test/core/DTManager.spec.ts +0 -874
- package/test/core/DTMaster.double.ts +0 -117
- package/test/core/DTMaster.spec.ts +0 -537
- package/test/core/DTModule.double.ts +0 -67
- package/test/core/DTModule.spec.ts +0 -124
- package/test/core/copy.spec.ts +0 -222
- 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 -19
- package/tsconfig.json +0 -18
- /package/{dist/constants.d.ts → constants.d.ts} +0 -0
- /package/{dist/constants.d.ts.map → constants.d.ts.map} +0 -0
- /package/{dist/constants.js → constants.js} +0 -0
- /package/{dist/constants.js.map → constants.js.map} +0 -0
- /package/{dist/core → core}/DTAction.d.ts +0 -0
- /package/{dist/core → core}/DTAction.d.ts.map +0 -0
- /package/{dist/core → core}/DTAction.js +0 -0
- /package/{dist/core → core}/DTAction.js.map +0 -0
- /package/{dist/core → core}/DTBunch.d.ts +0 -0
- /package/{dist/core → core}/DTBunch.d.ts.map +0 -0
- /package/{dist/core → core}/DTBunch.js +0 -0
- /package/{dist/core → core}/DTBunch.js.map +0 -0
- /package/{dist/core → core}/DTComponent.d.ts +0 -0
- /package/{dist/core → core}/DTComponent.d.ts.map +0 -0
- /package/{dist/core → core}/DTComponent.js +0 -0
- /package/{dist/core → core}/DTComponent.js.map +0 -0
- /package/{dist/core → core}/DTComponentPhysical.d.ts +0 -0
- /package/{dist/core → core}/DTComponentPhysical.d.ts.map +0 -0
- /package/{dist/core → core}/DTComponentPhysical.js +0 -0
- /package/{dist/core → core}/DTComponentPhysical.js.map +0 -0
- /package/{dist/core → core}/DTComponentWithMeta.d.ts +0 -0
- /package/{dist/core → core}/DTComponentWithMeta.d.ts.map +0 -0
- /package/{dist/core → core}/DTComponentWithMeta.js +0 -0
- /package/{dist/core → core}/DTComponentWithMeta.js.map +0 -0
- /package/{dist/core → core}/DTElement.d.ts +0 -0
- /package/{dist/core → core}/DTElement.d.ts.map +0 -0
- /package/{dist/core → core}/DTElement.js +0 -0
- /package/{dist/core → core}/DTElement.js.map +0 -0
- /package/{dist/core → core}/DTError.d.ts +0 -0
- /package/{dist/core → core}/DTError.d.ts.map +0 -0
- /package/{dist/core → core}/DTError.js +0 -0
- /package/{dist/core → core}/DTError.js.map +0 -0
- /package/{dist/core → core}/DTManager.d.ts +0 -0
- /package/{dist/core → core}/DTManager.d.ts.map +0 -0
- /package/{dist/core → core}/DTManager.js +0 -0
- /package/{dist/core → core}/DTManager.js.map +0 -0
- /package/{dist/core → core}/DTMaster.d.ts +0 -0
- /package/{dist/core → core}/DTMaster.d.ts.map +0 -0
- /package/{dist/core → core}/DTMaster.js +0 -0
- /package/{dist/core → core}/DTMaster.js.map +0 -0
- /package/{dist/core → core}/DTModule.d.ts +0 -0
- /package/{dist/core → core}/DTModule.d.ts.map +0 -0
- /package/{dist/core → core}/DTModule.js +0 -0
- /package/{dist/core → core}/DTModule.js.map +0 -0
- /package/{dist/index.js.map → index.js.map} +0 -0
- /package/{dist/libs → libs}/DYOFinder.d.ts +0 -0
- /package/{dist/libs → libs}/DYOFinder.d.ts.map +0 -0
- /package/{dist/libs → libs}/DYOFinder.js +0 -0
- /package/{dist/libs → libs}/DYOFinder.js.map +0 -0
- /package/{dist/libs → libs}/dix/DIXModule.module.d.ts +0 -0
- /package/{dist/libs → libs}/dix/DIXModule.module.d.ts.map +0 -0
- /package/{dist/libs → libs}/dix/DIXModule.module.js +0 -0
- /package/{dist/libs → libs}/player/DTPlayer.element.d.ts +0 -0
- /package/{dist/libs → libs}/player/DTPlayer.element.d.ts.map +0 -0
- /package/{dist/libs → libs}/player/DTPlayer.element.js +0 -0
- /package/{dist/libs → libs}/player/DTPlayer.element.js.map +0 -0
- /package/{dist/libs → libs}/player/DTPlayer.manager.d.ts +0 -0
- /package/{dist/libs → libs}/player/DTPlayer.manager.d.ts.map +0 -0
- /package/{dist/libs → libs}/player/DTPlayer.manager.js +0 -0
- /package/{dist/libs → libs}/player/DTPlayer.manager.js.map +0 -0
- /package/{dist/tsconfig.dev.tsbuildinfo → tsconfig.dev.tsbuildinfo} +0 -0
- /package/{dist/tsconfig.tsbuildinfo → tsconfig.tsbuildinfo} +0 -0
- /package/{dist/types → types}/core.d.ts +0 -0
- /package/{dist/types → types}/core.d.ts.map +0 -0
- /package/{dist/types → types}/core.js +0 -0
- /package/{dist/types → types}/core.js.map +0 -0
- /package/{dist/types → types}/index.d.ts +0 -0
- /package/{dist/types → types}/index.d.ts.map +0 -0
- /package/{dist/types → types}/index.js +0 -0
- /package/{dist/types → types}/index.js.map +0 -0
- /package/{dist/types → types}/player.d.ts +0 -0
- /package/{dist/types → types}/player.d.ts.map +0 -0
- /package/{dist/types → types}/player.js +0 -0
- /package/{dist/types → types}/player.js.map +0 -0
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import {expect} from '@jest/globals';
|
|
2
|
-
import {DTBunch, DTManager} from '../../src';
|
|
3
|
-
import {
|
|
4
|
-
bunch1toObjectTest,
|
|
5
|
-
DTBunchStub,
|
|
6
|
-
DTBunchStubLibrary,
|
|
7
|
-
generateStubElements,
|
|
8
|
-
IDTest as IDTestBunch,
|
|
9
|
-
} from './DTBunch.double';
|
|
10
|
-
import {DTManagerItemsType, DTManagerItemType, DTManagerOptions, DTManagerToObject} from '../../src/types';
|
|
11
|
-
import {DTElementStub,} from "./DTElement.double";
|
|
12
|
-
import {managerDefaultOptions} from "../../src/constants";
|
|
13
|
-
|
|
14
|
-
/** ****************** STUB PROPERTIES CONSTANTS
|
|
15
|
-
* Fixed properties to use with double classes, avoid auto generated and easy checking on test
|
|
16
|
-
* **** */
|
|
17
|
-
export const IDTest = 'DTManager-id-1234567';
|
|
18
|
-
export const KeyTest = 'DTManager-key-1234567';
|
|
19
|
-
export const DomainTest = 'DTManager-domain-test';
|
|
20
|
-
export const ScopesTest = ['DTManager-scope-test1', 'DTManager-scope-test2'];
|
|
21
|
-
|
|
22
|
-
// Specific Manager constants
|
|
23
|
-
export const manager1IDTest = `${IDTest}_1`;
|
|
24
|
-
export const manager1KeyTest = `${KeyTest}_1`;
|
|
25
|
-
|
|
26
|
-
export const manager1ToObject: DTManagerToObject = {
|
|
27
|
-
id: manager1IDTest,
|
|
28
|
-
key: manager1KeyTest,
|
|
29
|
-
type: 'manager',
|
|
30
|
-
items: [
|
|
31
|
-
{
|
|
32
|
-
scope: 'default',
|
|
33
|
-
...bunch1toObjectTest
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/** ****************** HELPER TEST CLASS
|
|
39
|
-
* Helper test class, inherits the main component
|
|
40
|
-
* Providing methods to property access and other facilities, in order to avoid using class methods
|
|
41
|
-
* **** */
|
|
42
|
-
export class DTManagerTest extends DTManager<DTElementStub> {
|
|
43
|
-
constructor(
|
|
44
|
-
id: string = IDTest,
|
|
45
|
-
key: string | undefined = undefined,
|
|
46
|
-
elements: DTElementStub[] = [],
|
|
47
|
-
scopes: string[] = [],
|
|
48
|
-
options: Partial<DTManagerOptions> = managerDefaultOptions,
|
|
49
|
-
stubLibrary: boolean = true,
|
|
50
|
-
) {
|
|
51
|
-
super(key, elements, scopes, options);
|
|
52
|
-
this._id = id;
|
|
53
|
-
if (stubLibrary) {
|
|
54
|
-
this._library = new DTBunchStubLibrary(elements);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
_getItems(): DTManagerItemsType<DTElementStub> {
|
|
59
|
-
return this._items;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
_getItem(id: string): DTManagerItemType<DTElementStub> | undefined {
|
|
63
|
-
return this._items[id];
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
_getFinder() {
|
|
67
|
-
return this._finder;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
populate() {
|
|
71
|
-
const stubElements = generateStubElements(5);
|
|
72
|
-
|
|
73
|
-
// Library
|
|
74
|
-
this._library = new DTBunchStubLibrary(stubElements);
|
|
75
|
-
this._library.setContext<DTManagerTest>(this);
|
|
76
|
-
|
|
77
|
-
// Bunches
|
|
78
|
-
const bunch1 = new DTBunchStub();
|
|
79
|
-
bunch1._setId(`${IDTestBunch}_1`);
|
|
80
|
-
bunch1.setContext<DTManagerTest>(this);
|
|
81
|
-
const bunch2 = new DTBunchStub();
|
|
82
|
-
bunch2._setId(`${IDTestBunch}_2`);
|
|
83
|
-
bunch2.setContext<DTManagerTest>(this);
|
|
84
|
-
const bunch3 = new DTBunchStub([], { virtualContainer: true });
|
|
85
|
-
bunch3._setId(`${IDTestBunch}_3`);
|
|
86
|
-
bunch3.setContext<DTManagerTest>(this);
|
|
87
|
-
this._items = {
|
|
88
|
-
[bunch1.getId()]: {
|
|
89
|
-
scope: 'default',
|
|
90
|
-
item: bunch1 as DTBunch<DTElementStub>,
|
|
91
|
-
},
|
|
92
|
-
[bunch2.getId()]: {
|
|
93
|
-
scope: ScopesTest[0],
|
|
94
|
-
item: bunch2 as DTBunch<DTElementStub>,
|
|
95
|
-
},
|
|
96
|
-
[bunch3.getId()]: {
|
|
97
|
-
scope: 'virtual',
|
|
98
|
-
item: bunch3 as DTBunch<DTElementStub>,
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
// Add items in Bunch
|
|
103
|
-
bunch1.addMany(stubElements);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export class DTManagerTestDomain extends DTManagerTest {
|
|
108
|
-
protected _domain = DomainTest;
|
|
109
|
-
|
|
110
|
-
constructor(
|
|
111
|
-
id: string = IDTest,
|
|
112
|
-
key: string | undefined = undefined,
|
|
113
|
-
) {
|
|
114
|
-
super(id, key);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/** ****************** STUB CLASS
|
|
119
|
-
* Stub class, for using in other component
|
|
120
|
-
* **** */
|
|
121
|
-
export class DTManagerStub extends DTManager<DTElementStub> {
|
|
122
|
-
constructor() {
|
|
123
|
-
super();
|
|
124
|
-
this._id = IDTest;
|
|
125
|
-
this._key = KeyTest;
|
|
126
|
-
this._errors = [];
|
|
127
|
-
this._library = new DTBunchStubLibrary();
|
|
128
|
-
this._scopes = [
|
|
129
|
-
'default',
|
|
130
|
-
'virtual',
|
|
131
|
-
...ScopesTest,
|
|
132
|
-
];
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
_setId(id: string) {
|
|
136
|
-
this._id = id;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
_setKey(key: string) {
|
|
140
|
-
this._key = key;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export const checkManagerItem = (managerTest: DTManagerTest, bunchId: string, scope: string): void => {
|
|
145
|
-
expect(managerTest._getItem(bunchId)).toBeDefined();
|
|
146
|
-
expect(Object.keys(managerTest._getItem(bunchId))).toStrictEqual(['scope', 'item']);
|
|
147
|
-
expect(managerTest._getItem(bunchId)?.scope).toBe(scope);
|
|
148
|
-
expect(managerTest._getItem(bunchId)?.item?.getId()).toBe(bunchId);
|
|
149
|
-
};
|