definition-generator-framework 1.12.5 → 1.12.7
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/framework/definition-component.d.ts +11 -9
- package/dist/framework/definition-component.js +18 -18
- package/dist/framework/definition-generator.d.ts +6 -5
- package/dist/framework/definition-generator.js +16 -18
- package/dist/framework/file-content-generator/file-content-generator.js +1 -1
- package/dist/framework/file-content-generator/file-content-generator.test.js +49 -49
- package/dist/framework/framework.d.ts +14 -13
- package/dist/framework/framework.data.d.ts +3 -3
- package/dist/framework/framework.data.js +13 -7
- package/dist/framework/framework.js +36 -33
- package/dist/framework/framework.model.d.ts +15 -15
- package/dist/framework/framework.model.js +3 -3
- package/dist/framework/index-file-generator/index-file-generator.js +2 -4
- package/dist/helpers/common-functions/common-functions.js +1 -1
- package/dist/helpers/common-functions/common-functions.spec.js +48 -48
- package/dist/helpers/duplicate-helper/duplicate-helper.spec.js +52 -52
- package/dist/helpers/output-helper/output-helper.d.ts +26 -26
- package/dist/helpers/output-helper/output-helper.js +127 -107
- package/dist/helpers/output-helper/output-helper.spec.d.ts +22 -22
- package/dist/helpers/output-helper/output-helper.spec.js +223 -211
- package/dist/helpers/output-helper/output-helper.test.d.ts +22 -22
- package/dist/helpers/output-helper/output-helper.test.js +224 -212
- package/dist/helpers/raw-definition-helper/raw-definition.helper.spec.js +133 -125
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.spec.d.ts +1 -1
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.spec.js +174 -156
- package/dist/helpers/validator/custom-validators/image.custom-validator.d.ts +6 -6
- package/dist/helpers/validator/custom-validators/image.custom-validator.js +40 -39
- package/dist/helpers/validator/custom-validators/unique-name-group.custom-validator.d.ts +4 -4
- package/dist/helpers/validator/custom-validators/unique-name-group.custom-validator.js +29 -29
- package/dist/helpers/validator/joi-custom-validators.spec.js +284 -240
- package/dist/helpers/validator/validator.spec.js +313 -303
- package/dist/pipeline/1-select-definitions-helper.d.ts +13 -13
- package/dist/pipeline/1-select-definitions-helper.js +68 -72
- package/dist/pipeline/1-select-definitions.helper.test.js +40 -40
- package/dist/pipeline/1-select-definitions.spec.js +131 -131
- package/dist/pipeline/2-structure-parser.helper.spec.js +266 -266
- package/dist/pipeline/parsers/array-parser.spec.js +116 -113
- package/dist/pipeline/parsers/object-parser.spec.js +159 -153
- package/dist/pipeline/parsers/primitive-parser.spec.js +67 -67
- package/dist/pre-made-components/assets/3-font.js +4 -4
- package/dist/pre-made-components/events/1-event.d.ts +1 -1
- package/dist/pre-made-components/events/1-event.js +157 -125
- package/dist/pre-made-components/events/2-event-test.d.ts +8 -8
- package/dist/pre-made-components/events/2-event-test.js +156 -119
- package/dist/pre-made-components/events/2-script-test.js +0 -1
- package/dist/pre-made-components/events/event-setup.d.ts +10 -5
- package/dist/pre-made-components/events/event-setup.js +15 -15
- package/dist/pre-made-components/events/script-setup.d.ts +5 -3
- package/dist/pre-made-components/events/script-setup.js +11 -11
- package/package.json +5 -10
|
@@ -1,249 +1,261 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
3
|
exports.Const = void 0;
|
|
4
|
-
const mocks_1 = require(
|
|
5
|
-
const context_1 = require(
|
|
6
|
-
const output_helper_1 = require(
|
|
4
|
+
const mocks_1 = require('../../_mocks/mocks');
|
|
5
|
+
const context_1 = require('../../framework/context');
|
|
6
|
+
const output_helper_1 = require('./output-helper');
|
|
7
7
|
let complexObject = {
|
|
8
|
+
type: 'bow',
|
|
9
|
+
material: 'WoodenItemMaterial',
|
|
10
|
+
maxQuantity: 10,
|
|
11
|
+
mainHand: undefined,
|
|
12
|
+
offHand: undefined,
|
|
13
|
+
bothHands: {
|
|
14
|
+
imageOnCharacter: 'BodyPartImageNames',
|
|
15
|
+
parryDice: undefined,
|
|
16
|
+
attacks: [
|
|
17
|
+
{
|
|
18
|
+
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
19
|
+
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
20
|
+
range: 'WeaponRange.ranged',
|
|
21
|
+
requiresSetup: false,
|
|
22
|
+
unparryable: true,
|
|
23
|
+
lowersQuantity: true,
|
|
24
|
+
projectileType: 'ProjectileType.arrow',
|
|
25
|
+
sounds: {
|
|
26
|
+
hit: 'AssetGroups.battleSoundArrowHit',
|
|
27
|
+
pre: 'AssetGroups.battleSoundArrowShot'
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
let emptyArrayExpected = `export const Groups: any[] = [];
|
|
34
|
+
`;
|
|
35
|
+
let basicArrayExpected = `export const Groups: any[] = [
|
|
36
|
+
{ name: 'test1', source: './src/definitions-sample/images/test1.png' },
|
|
37
|
+
{ name: 'test2', source: './src/definitions-sample/images/test2.png', pixelPerfectInteraction: true }
|
|
38
|
+
];
|
|
39
|
+
`;
|
|
40
|
+
let complexArrayExpected = `export const Groups: any[] = [
|
|
41
|
+
{
|
|
8
42
|
type: 'bow',
|
|
9
43
|
material: 'WoodenItemMaterial',
|
|
10
44
|
maxQuantity: 10,
|
|
11
45
|
mainHand: undefined,
|
|
12
46
|
offHand: undefined,
|
|
13
47
|
bothHands: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
]
|
|
48
|
+
imageOnCharacter: 'BodyPartImageNames',
|
|
49
|
+
parryDice: undefined,
|
|
50
|
+
attacks: [
|
|
51
|
+
{
|
|
52
|
+
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
53
|
+
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
54
|
+
range: 'WeaponRange.ranged',
|
|
55
|
+
requiresSetup: false,
|
|
56
|
+
unparryable: true,
|
|
57
|
+
lowersQuantity: true,
|
|
58
|
+
projectileType: 'ProjectileType.arrow',
|
|
59
|
+
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
60
|
+
}
|
|
61
|
+
]
|
|
31
62
|
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
`;
|
|
35
|
-
let basicArrayExpected = `export const Groups: any[] = [
|
|
36
|
-
{ name: 'test1', source: './src/definitions-sample/images/test1.png' },
|
|
37
|
-
{ name: 'test2', source: './src/definitions-sample/images/test2.png', pixelPerfectInteraction: true }
|
|
38
|
-
];
|
|
39
|
-
`;
|
|
40
|
-
let complexArrayExpected = `export const Groups: any[] = [
|
|
41
|
-
{
|
|
42
|
-
type: 'bow',
|
|
43
|
-
material: 'WoodenItemMaterial',
|
|
44
|
-
maxQuantity: 10,
|
|
45
|
-
mainHand: undefined,
|
|
46
|
-
offHand: undefined,
|
|
47
|
-
bothHands: {
|
|
48
|
-
imageOnCharacter: 'BodyPartImageNames',
|
|
49
|
-
parryDice: undefined,
|
|
50
|
-
attacks: [
|
|
51
|
-
{
|
|
52
|
-
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
53
|
-
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
54
|
-
range: 'WeaponRange.ranged',
|
|
55
|
-
requiresSetup: false,
|
|
56
|
-
unparryable: true,
|
|
57
|
-
lowersQuantity: true,
|
|
58
|
-
projectileType: 'ProjectileType.arrow',
|
|
59
|
-
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
];
|
|
65
|
-
`;
|
|
66
|
-
let complexArrayReplaceExpected = `export const Groups: any[] = [
|
|
67
|
-
{
|
|
68
|
-
type: 'bow',
|
|
69
|
-
material: 'WoodenItemMaterial',
|
|
70
|
-
maxQuantity: 10,
|
|
71
|
-
mainHand: undefined,
|
|
72
|
-
offHand: undefined,
|
|
73
|
-
bothHands: {
|
|
74
|
-
imageOnCharacter: 'BodyPartImageNames',
|
|
75
|
-
parryDice: undefined,
|
|
76
|
-
attacks: [
|
|
77
|
-
{
|
|
78
|
-
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
79
|
-
attackDices: [DiceType.d6, DiceType.d6],
|
|
80
|
-
range: 'WeaponRange.ranged',
|
|
81
|
-
requiresSetup: false,
|
|
82
|
-
unparryable: true,
|
|
83
|
-
lowersQuantity: true,
|
|
84
|
-
projectileType: 'ProjectileType.arrow',
|
|
85
|
-
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
86
|
-
}
|
|
87
|
-
]
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
];
|
|
63
|
+
}
|
|
64
|
+
];
|
|
91
65
|
`;
|
|
92
|
-
|
|
66
|
+
let complexArrayReplaceExpected = `export const Groups: any[] = [
|
|
67
|
+
{
|
|
93
68
|
type: 'bow',
|
|
94
69
|
material: 'WoodenItemMaterial',
|
|
95
70
|
maxQuantity: 10,
|
|
96
71
|
mainHand: undefined,
|
|
97
72
|
offHand: undefined,
|
|
98
73
|
bothHands: {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
]
|
|
74
|
+
imageOnCharacter: 'BodyPartImageNames',
|
|
75
|
+
parryDice: undefined,
|
|
76
|
+
attacks: [
|
|
77
|
+
{
|
|
78
|
+
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
79
|
+
attackDices: [DiceType.d6, DiceType.d6],
|
|
80
|
+
range: 'WeaponRange.ranged',
|
|
81
|
+
requiresSetup: false,
|
|
82
|
+
unparryable: true,
|
|
83
|
+
lowersQuantity: true,
|
|
84
|
+
projectileType: 'ProjectileType.arrow',
|
|
85
|
+
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
86
|
+
}
|
|
87
|
+
]
|
|
116
88
|
}
|
|
89
|
+
}
|
|
90
|
+
];
|
|
91
|
+
`;
|
|
92
|
+
exports.Const = {
|
|
93
|
+
type: 'bow',
|
|
94
|
+
material: 'WoodenItemMaterial',
|
|
95
|
+
maxQuantity: 10,
|
|
96
|
+
mainHand: undefined,
|
|
97
|
+
offHand: undefined,
|
|
98
|
+
bothHands: {
|
|
99
|
+
imageOnCharacter: 'BodyPartImageNames',
|
|
100
|
+
parryDice: undefined,
|
|
101
|
+
attacks: [
|
|
102
|
+
{
|
|
103
|
+
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
104
|
+
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
105
|
+
range: 'WeaponRange.ranged',
|
|
106
|
+
requiresSetup: false,
|
|
107
|
+
unparryable: true,
|
|
108
|
+
lowersQuantity: true,
|
|
109
|
+
projectileType: 'ProjectileType.arrow',
|
|
110
|
+
sounds: {
|
|
111
|
+
hit: 'AssetGroups.battleSoundArrowHit',
|
|
112
|
+
pre: 'AssetGroups.battleSoundArrowShot'
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
117
|
};
|
|
118
|
-
let noTypeExpected = `export const ConstSample = { type: 'item' };
|
|
118
|
+
let noTypeExpected = `export const ConstSample = { type: 'item' };
|
|
119
119
|
`;
|
|
120
|
-
let basicConstExpected = `export const ConstSample: string = 'basic';
|
|
120
|
+
let basicConstExpected = `export const ConstSample: string = 'basic';
|
|
121
121
|
`;
|
|
122
|
-
let complexConstExpected = `export const ConstSample: any = {
|
|
123
|
-
type: 'bow',
|
|
124
|
-
material: 'WoodenItemMaterial',
|
|
125
|
-
maxQuantity: 10,
|
|
126
|
-
mainHand: undefined,
|
|
127
|
-
offHand: undefined,
|
|
128
|
-
bothHands: {
|
|
129
|
-
imageOnCharacter: 'BodyPartImageNames',
|
|
130
|
-
parryDice: undefined,
|
|
131
|
-
attacks: [
|
|
132
|
-
{
|
|
133
|
-
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
134
|
-
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
135
|
-
range: 'WeaponRange.ranged',
|
|
136
|
-
requiresSetup: false,
|
|
137
|
-
unparryable: true,
|
|
138
|
-
lowersQuantity: true,
|
|
139
|
-
projectileType: 'ProjectileType.arrow',
|
|
140
|
-
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
141
|
-
}
|
|
142
|
-
]
|
|
143
|
-
}
|
|
144
|
-
};
|
|
122
|
+
let complexConstExpected = `export const ConstSample: any = {
|
|
123
|
+
type: 'bow',
|
|
124
|
+
material: 'WoodenItemMaterial',
|
|
125
|
+
maxQuantity: 10,
|
|
126
|
+
mainHand: undefined,
|
|
127
|
+
offHand: undefined,
|
|
128
|
+
bothHands: {
|
|
129
|
+
imageOnCharacter: 'BodyPartImageNames',
|
|
130
|
+
parryDice: undefined,
|
|
131
|
+
attacks: [
|
|
132
|
+
{
|
|
133
|
+
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
134
|
+
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
135
|
+
range: 'WeaponRange.ranged',
|
|
136
|
+
requiresSetup: false,
|
|
137
|
+
unparryable: true,
|
|
138
|
+
lowersQuantity: true,
|
|
139
|
+
projectileType: 'ProjectileType.arrow',
|
|
140
|
+
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
145
|
`;
|
|
146
|
-
let complexConstReplaceExpected = `export const ConstSample: any = {
|
|
147
|
-
type: 'bow',
|
|
148
|
-
material: 'WoodenItemMaterial',
|
|
149
|
-
maxQuantity: 10,
|
|
150
|
-
mainHand: undefined,
|
|
151
|
-
offHand: undefined,
|
|
152
|
-
bothHands: {
|
|
153
|
-
imageOnCharacter: 'BodyPartImageNames',
|
|
154
|
-
parryDice: undefined,
|
|
155
|
-
attacks: [
|
|
156
|
-
{
|
|
157
|
-
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
158
|
-
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
159
|
-
range: WeaponRange,
|
|
160
|
-
requiresSetup: false,
|
|
161
|
-
unparryable: true,
|
|
162
|
-
lowersQuantity: true,
|
|
163
|
-
projectileType: 'ProjectileType.arrow',
|
|
164
|
-
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
165
|
-
}
|
|
166
|
-
]
|
|
167
|
-
}
|
|
168
|
-
};
|
|
146
|
+
let complexConstReplaceExpected = `export const ConstSample: any = {
|
|
147
|
+
type: 'bow',
|
|
148
|
+
material: 'WoodenItemMaterial',
|
|
149
|
+
maxQuantity: 10,
|
|
150
|
+
mainHand: undefined,
|
|
151
|
+
offHand: undefined,
|
|
152
|
+
bothHands: {
|
|
153
|
+
imageOnCharacter: 'BodyPartImageNames',
|
|
154
|
+
parryDice: undefined,
|
|
155
|
+
attacks: [
|
|
156
|
+
{
|
|
157
|
+
actionIcon: 'AssetNames.characterActionBowAttack',
|
|
158
|
+
attackDices: ['DiceType.d6', 'DiceType.d6'],
|
|
159
|
+
range: WeaponRange,
|
|
160
|
+
requiresSetup: false,
|
|
161
|
+
unparryable: true,
|
|
162
|
+
lowersQuantity: true,
|
|
163
|
+
projectileType: 'ProjectileType.arrow',
|
|
164
|
+
sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
169
|
`;
|
|
170
170
|
describe('Output Helper: Array Output', () => {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
test('should handle empty array', async () => {
|
|
172
|
+
let output = await output_helper_1.OutputHelper.generateArrayOutput({
|
|
173
|
+
variableName: 'Groups',
|
|
174
|
+
variableType: 'any[]',
|
|
175
|
+
variable: []
|
|
174
176
|
});
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
177
|
+
expect(output).toStrictEqual(emptyArrayExpected);
|
|
178
|
+
});
|
|
179
|
+
test('should handle basic array', async () => {
|
|
180
|
+
let output = await output_helper_1.OutputHelper.generateArrayOutput({
|
|
181
|
+
variableName: 'Groups',
|
|
182
|
+
variableType: 'any[]',
|
|
183
|
+
variable: [
|
|
184
|
+
{ name: 'test1', source: './src/definitions-sample/images/test1.png' },
|
|
185
|
+
{ name: 'test2', source: './src/definitions-sample/images/test2.png', pixelPerfectInteraction: true }
|
|
186
|
+
]
|
|
185
187
|
});
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
188
|
+
expect(output).toStrictEqual(basicArrayExpected);
|
|
189
|
+
});
|
|
190
|
+
test('should handle complex array', async () => {
|
|
191
|
+
let output = await output_helper_1.OutputHelper.generateArrayOutput({
|
|
192
|
+
variableName: 'Groups',
|
|
193
|
+
variableType: 'any[]',
|
|
194
|
+
variable: [complexObject]
|
|
193
195
|
});
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
196
|
+
expect(output).toStrictEqual(complexArrayExpected);
|
|
197
|
+
});
|
|
198
|
+
test('should handle replacing complex array', async () => {
|
|
199
|
+
let output = await output_helper_1.OutputHelper.generateArrayOutput({
|
|
200
|
+
variableName: 'Groups',
|
|
201
|
+
variableType: 'any[]',
|
|
202
|
+
variable: [complexObject],
|
|
203
|
+
replaceMap: [{ target: `"DiceType.d6"`, replace: 'DiceType.d6' }]
|
|
202
204
|
});
|
|
205
|
+
expect(output).toStrictEqual(complexArrayReplaceExpected);
|
|
206
|
+
});
|
|
203
207
|
});
|
|
204
208
|
describe('Output Helper: Const Output', () => {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
test('should handle no type', async () => {
|
|
210
|
+
let output = await output_helper_1.OutputHelper.generateOutput({ variableName: 'ConstSample', variable: { type: 'item' } });
|
|
211
|
+
expect(output).toStrictEqual(noTypeExpected);
|
|
212
|
+
});
|
|
213
|
+
test('should handle basic value', async () => {
|
|
214
|
+
let output = await output_helper_1.OutputHelper.generateOutput({
|
|
215
|
+
variableName: 'ConstSample',
|
|
216
|
+
variableType: 'string',
|
|
217
|
+
variable: 'basic'
|
|
212
218
|
});
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
219
|
+
expect(output).toStrictEqual(basicConstExpected);
|
|
220
|
+
});
|
|
221
|
+
test('should handle complex object', async () => {
|
|
222
|
+
let output = await output_helper_1.OutputHelper.generateOutput({
|
|
223
|
+
variableName: 'ConstSample',
|
|
224
|
+
variableType: 'any',
|
|
225
|
+
variable: complexObject
|
|
216
226
|
});
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
227
|
+
expect(output).toStrictEqual(complexConstExpected);
|
|
228
|
+
});
|
|
229
|
+
test('should handle replacing complex object', async () => {
|
|
230
|
+
let output = await output_helper_1.OutputHelper.generateOutput({
|
|
231
|
+
variableName: 'ConstSample',
|
|
232
|
+
variableType: 'any',
|
|
233
|
+
variable: complexObject,
|
|
234
|
+
replaceMap: [{ target: `"WeaponRange.ranged"`, replace: 'WeaponRange' }]
|
|
225
235
|
});
|
|
236
|
+
expect(output).toStrictEqual(complexConstReplaceExpected);
|
|
237
|
+
});
|
|
226
238
|
});
|
|
227
239
|
describe('Output Helper: stringify', () => {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
});
|
|
234
|
-
expect(output).toStrictEqual('{"a":undefined,"b":undefined}');
|
|
240
|
+
test('should not lose properties with undefined or null value', async () => {
|
|
241
|
+
let output = await output_helper_1.OutputHelper['stringify']({
|
|
242
|
+
a: undefined,
|
|
243
|
+
// eslint-disable-next-line no-null/no-null
|
|
244
|
+
b: null
|
|
235
245
|
});
|
|
246
|
+
expect(output).toStrictEqual('{"a":undefined,"b":undefined}');
|
|
247
|
+
});
|
|
236
248
|
});
|
|
237
249
|
describe('Output Helper: convertToRelativePath', () => {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
250
|
+
test('should convert to relative path', async () => {
|
|
251
|
+
(0, mocks_1.resetContext)();
|
|
252
|
+
context_1.Context.outputPath = 'D:/Projects/Game-Dev/Starfighter/Starfighter-Definitions-Generator/src/.asset-build';
|
|
253
|
+
context_1.Context.config.projectRoot = 'D:/Projects/Game-Dev/Starfighter/Starfighter-Definitions-Generator/';
|
|
254
|
+
let original = '.src/definitions-sample/images/nested/test2.png';
|
|
255
|
+
let desired = '../../../definitions-sample/images/nested/test2.png';
|
|
256
|
+
let filePath = '/0-global-definitions/assets/images.ts';
|
|
257
|
+
let output = output_helper_1.OutputHelper['convertToRelativePath'](filePath, original);
|
|
258
|
+
expect(output).toStrictEqual(desired);
|
|
259
|
+
});
|
|
248
260
|
});
|
|
249
|
-
//# sourceMappingURL=output-helper.spec.js.map
|
|
261
|
+
//# sourceMappingURL=output-helper.spec.js.map
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
export declare const Const: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
2
|
+
type: string;
|
|
3
|
+
material: string;
|
|
4
|
+
maxQuantity: number;
|
|
5
|
+
mainHand: undefined;
|
|
6
|
+
offHand: undefined;
|
|
7
|
+
bothHands: {
|
|
8
|
+
imageOnCharacter: string;
|
|
9
|
+
parryDice: undefined;
|
|
10
|
+
attacks: {
|
|
11
|
+
actionIcon: string;
|
|
12
|
+
attackDices: string[];
|
|
13
|
+
range: string;
|
|
14
|
+
requiresSetup: boolean;
|
|
15
|
+
unparryable: boolean;
|
|
16
|
+
lowersQuantity: boolean;
|
|
17
|
+
projectileType: string;
|
|
18
|
+
sounds: {
|
|
19
|
+
hit: string;
|
|
20
|
+
pre: string;
|
|
21
|
+
};
|
|
22
|
+
}[];
|
|
23
|
+
};
|
|
24
24
|
};
|