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