@contrail/flexplm 1.3.0 → 1.3.1-alpha.eae3d9f
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/.github/workflows/flexplm-lib.yml +1 -1
- package/.github/workflows/publish-to-npm.yml +35 -38
- package/lib/entity-processor/base-entity-processor.d.ts +42 -42
- package/lib/entity-processor/base-entity-processor.js +385 -385
- package/lib/entity-processor/base-entity-processor.spec.d.ts +1 -1
- package/lib/entity-processor/base-entity-processor.spec.js +397 -397
- package/lib/flexplm-request.d.ts +3 -3
- package/lib/flexplm-request.js +34 -34
- package/lib/flexplm-utils.d.ts +5 -5
- package/lib/flexplm-utils.js +33 -33
- package/lib/flexplm-utils.spec.d.ts +1 -1
- package/lib/flexplm-utils.spec.js +26 -26
- package/lib/index.d.ts +22 -22
- package/lib/index.js +38 -38
- package/lib/interfaces/interfaces.d.ts +105 -105
- package/lib/interfaces/interfaces.js +2 -2
- package/lib/interfaces/item-family-changes.d.ts +20 -20
- package/lib/interfaces/item-family-changes.js +56 -56
- package/lib/interfaces/publish-change-data.d.ts +19 -19
- package/lib/interfaces/publish-change-data.js +32 -32
- package/lib/publish/base-process-publish-assortment-callback.d.ts +9 -9
- package/lib/publish/base-process-publish-assortment-callback.js +38 -38
- package/lib/publish/base-process-publish-assortment.d.ts +93 -93
- package/lib/publish/base-process-publish-assortment.js +944 -944
- package/lib/publish/base-process-publish-assortment.spec.d.ts +1 -1
- package/lib/publish/base-process-publish-assortment.spec.js +1670 -1670
- package/lib/publish/mockData.d.ts +1389 -1389
- package/lib/publish/mockData.js +4519 -4519
- package/lib/transform/identifier-conversion-spec-mockData.js +444 -444
- package/lib/transform/identifier-conversion.d.ts +15 -15
- package/lib/transform/identifier-conversion.js +212 -212
- package/lib/transform/identifier-conversion.spec.d.ts +1 -1
- package/lib/transform/identifier-conversion.spec.js +339 -339
- package/lib/util/config-defaults.d.ts +8 -8
- package/lib/util/config-defaults.js +85 -85
- package/lib/util/config-defaults.spec.d.ts +1 -1
- package/lib/util/config-defaults.spec.js +293 -293
- package/lib/util/data-converter-spec-mockData.js +205 -205
- package/lib/util/data-converter.d.ts +39 -39
- package/lib/util/data-converter.js +592 -592
- package/lib/util/data-converter.spec.d.ts +1 -1
- package/lib/util/data-converter.spec.js +904 -904
- package/lib/util/error-response-object.d.ts +4 -4
- package/lib/util/error-response-object.js +47 -47
- package/lib/util/error-response-object.spec.d.ts +1 -1
- package/lib/util/error-response-object.spec.js +99 -99
- package/lib/util/event-short-message-status.d.ts +19 -19
- package/lib/util/event-short-message-status.js +23 -23
- package/lib/util/federation.d.ts +15 -15
- package/lib/util/federation.js +149 -149
- package/lib/util/flexplm-connect.d.ts +22 -22
- package/lib/util/flexplm-connect.js +176 -176
- package/lib/util/flexplm-connect.spec.d.ts +1 -1
- package/lib/util/flexplm-connect.spec.js +88 -88
- package/lib/util/logger-config.d.ts +1 -1
- package/lib/util/logger-config.js +26 -26
- package/lib/util/map-util-spec-mockData.js +205 -205
- package/lib/util/map-utils.d.ts +6 -6
- package/lib/util/map-utils.js +15 -15
- package/lib/util/map-utils.spec.d.ts +1 -1
- package/lib/util/map-utils.spec.js +89 -89
- package/lib/util/mockData.d.ts +80 -80
- package/lib/util/mockData.js +103 -103
- package/lib/util/thumbnail-util.d.ts +34 -34
- package/lib/util/thumbnail-util.js +215 -215
- package/lib/util/thumbnail-util.spec.d.ts +1 -1
- package/lib/util/thumbnail-util.spec.js +434 -434
- package/lib/util/type-conversion-utils-spec-mockData.js +259 -259
- package/lib/util/type-conversion-utils.d.ts +23 -23
- package/lib/util/type-conversion-utils.js +265 -265
- package/lib/util/type-conversion-utils.spec.d.ts +1 -1
- package/lib/util/type-conversion-utils.spec.js +868 -868
- package/lib/util/type-defaults.d.ts +16 -16
- package/lib/util/type-defaults.js +221 -221
- package/lib/util/type-defaults.spec.d.ts +1 -1
- package/lib/util/type-defaults.spec.js +516 -516
- package/lib/util/type-utils.d.ts +13 -13
- package/lib/util/type-utils.js +114 -114
- package/lib/util/type-utils.spec.d.ts +1 -1
- package/lib/util/type-utils.spec.js +190 -190
- package/package.json +1 -1
- package/publish.sh +0 -0
- package/tsconfig.json +1 -6
- package/.claude/settings.local.json +0 -8
|
@@ -1,516 +1,516 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const type_defaults_1 = require("./type-defaults");
|
|
4
|
-
describe('Type Defaults', () => {
|
|
5
|
-
describe('getDefaultObjectClass', () => {
|
|
6
|
-
it('LCSProduct', () => {
|
|
7
|
-
const newData = {
|
|
8
|
-
entityType: 'item',
|
|
9
|
-
roles: ['family']
|
|
10
|
-
};
|
|
11
|
-
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
12
|
-
expect(objectClass).toEqual('LCSProduct');
|
|
13
|
-
});
|
|
14
|
-
it('LCSSKU', () => {
|
|
15
|
-
const newData = {
|
|
16
|
-
entityType: 'item',
|
|
17
|
-
roles: ['color']
|
|
18
|
-
};
|
|
19
|
-
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
20
|
-
expect(objectClass).toEqual('LCSSKU');
|
|
21
|
-
});
|
|
22
|
-
it('LCSProductSeasonLink', () => {
|
|
23
|
-
const newData = {
|
|
24
|
-
entityType: 'project-item',
|
|
25
|
-
roles: ['family']
|
|
26
|
-
};
|
|
27
|
-
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
28
|
-
expect(objectClass).toEqual('LCSProductSeasonLink');
|
|
29
|
-
});
|
|
30
|
-
it('LCSSKUSeasonLink', () => {
|
|
31
|
-
const newData = {
|
|
32
|
-
entityType: 'project-item',
|
|
33
|
-
roles: ['color']
|
|
34
|
-
};
|
|
35
|
-
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
36
|
-
expect(objectClass).toEqual('LCSSKUSeasonLink');
|
|
37
|
-
});
|
|
38
|
-
it('LCSColor', () => {
|
|
39
|
-
const newData = {
|
|
40
|
-
entityType: 'color'
|
|
41
|
-
};
|
|
42
|
-
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
43
|
-
expect(objectClass).toEqual('LCSColor');
|
|
44
|
-
});
|
|
45
|
-
it('LCSRevisableEntity', () => {
|
|
46
|
-
const newData = {
|
|
47
|
-
entityType: 'custom-entity'
|
|
48
|
-
};
|
|
49
|
-
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
50
|
-
expect(objectClass).toEqual('LCSRevisableEntity');
|
|
51
|
-
});
|
|
52
|
-
it('LCSSeason - project', () => {
|
|
53
|
-
const newData = {
|
|
54
|
-
entityType: 'project'
|
|
55
|
-
};
|
|
56
|
-
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
57
|
-
expect(objectClass).toEqual('LCSSeason');
|
|
58
|
-
});
|
|
59
|
-
it('Season Group', () => {
|
|
60
|
-
const newData = {
|
|
61
|
-
entityType: 'assortment'
|
|
62
|
-
};
|
|
63
|
-
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
64
|
-
expect(objectClass).toEqual('SeasonGroup');
|
|
65
|
-
});
|
|
66
|
-
it('LCSSeason - assortment - publishToFlexPLM=true', () => {
|
|
67
|
-
const newData = {
|
|
68
|
-
entityType: 'assortment',
|
|
69
|
-
publishToFlexPLM: true
|
|
70
|
-
};
|
|
71
|
-
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
72
|
-
expect(objectClass).toEqual('LCSSeason');
|
|
73
|
-
});
|
|
74
|
-
it('LCSSeason - assortment - publishToFlexPLM=true', () => {
|
|
75
|
-
const newData = {
|
|
76
|
-
entityType: 'assortment',
|
|
77
|
-
flex2vibeMapKeyRoot: 'LCSSeason'
|
|
78
|
-
};
|
|
79
|
-
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
80
|
-
expect(objectClass).toEqual('LCSSeason');
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
describe('getDefaultObjectTypePath', () => {
|
|
84
|
-
it('item-family', () => {
|
|
85
|
-
const newData = {
|
|
86
|
-
entityType: 'item',
|
|
87
|
-
roles: ['family']
|
|
88
|
-
};
|
|
89
|
-
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
90
|
-
expect(typePath).toEqual('Product');
|
|
91
|
-
});
|
|
92
|
-
it('item-color', () => {
|
|
93
|
-
const newData = {
|
|
94
|
-
entityType: 'item',
|
|
95
|
-
roles: ['color']
|
|
96
|
-
};
|
|
97
|
-
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
98
|
-
expect(typePath).toEqual('Product');
|
|
99
|
-
});
|
|
100
|
-
it('project-item-family', () => {
|
|
101
|
-
const newData = {
|
|
102
|
-
entityType: 'project-item',
|
|
103
|
-
roles: ['family']
|
|
104
|
-
};
|
|
105
|
-
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
106
|
-
expect(typePath).toEqual('Product');
|
|
107
|
-
});
|
|
108
|
-
it('project-item-color', () => {
|
|
109
|
-
const newData = {
|
|
110
|
-
entityType: 'project-item',
|
|
111
|
-
roles: ['color']
|
|
112
|
-
};
|
|
113
|
-
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
114
|
-
expect(typePath).toEqual('Product');
|
|
115
|
-
});
|
|
116
|
-
it('color', () => {
|
|
117
|
-
const newData = {
|
|
118
|
-
entityType: 'color'
|
|
119
|
-
};
|
|
120
|
-
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
121
|
-
expect(typePath).toEqual('Color');
|
|
122
|
-
});
|
|
123
|
-
it('custom-entity', () => {
|
|
124
|
-
const newData = {
|
|
125
|
-
entityType: 'custom-entity'
|
|
126
|
-
};
|
|
127
|
-
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
128
|
-
expect(typePath).toEqual('Revisable Entity');
|
|
129
|
-
});
|
|
130
|
-
it('project', () => {
|
|
131
|
-
const newData = {
|
|
132
|
-
entityType: 'project'
|
|
133
|
-
};
|
|
134
|
-
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
135
|
-
expect(typePath).toEqual('Season');
|
|
136
|
-
});
|
|
137
|
-
it('assortment', () => {
|
|
138
|
-
const newData = {
|
|
139
|
-
entityType: 'assortment'
|
|
140
|
-
};
|
|
141
|
-
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
142
|
-
expect(typePath).toEqual('Season Group');
|
|
143
|
-
});
|
|
144
|
-
it('assortment - publishToFlexPLM=true', () => {
|
|
145
|
-
const newData = {
|
|
146
|
-
entityType: 'assortment',
|
|
147
|
-
publishToFlexPLM: true
|
|
148
|
-
};
|
|
149
|
-
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
150
|
-
expect(typePath).toEqual('Season');
|
|
151
|
-
});
|
|
152
|
-
it('assortment - flex2vibeMapKeyRoot=LCSSeason', () => {
|
|
153
|
-
const newData = {
|
|
154
|
-
entityType: 'assortment',
|
|
155
|
-
flex2vibeMapKeyRoot: 'LCSSeason'
|
|
156
|
-
};
|
|
157
|
-
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
158
|
-
expect(typePath).toEqual('Season');
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
describe('getDefaultIdentifiers', () => {
|
|
162
|
-
it('item-family', () => {
|
|
163
|
-
const newData = {
|
|
164
|
-
entityType: 'item',
|
|
165
|
-
roles: ['family']
|
|
166
|
-
};
|
|
167
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
|
|
168
|
-
expect(defaultIdentifiers).toContain('itemNumber');
|
|
169
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
170
|
-
});
|
|
171
|
-
it('item-color', () => {
|
|
172
|
-
const newData = {
|
|
173
|
-
entityType: 'item',
|
|
174
|
-
roles: ['color']
|
|
175
|
-
};
|
|
176
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
|
|
177
|
-
expect(defaultIdentifiers).toContain('itemNumber');
|
|
178
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
179
|
-
});
|
|
180
|
-
it('project', () => {
|
|
181
|
-
const newData = {
|
|
182
|
-
entityType: 'project'
|
|
183
|
-
};
|
|
184
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
|
|
185
|
-
expect(defaultIdentifiers).toContain('flexPLMSeasonName');
|
|
186
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
187
|
-
});
|
|
188
|
-
it('assortment', () => {
|
|
189
|
-
const newData = {
|
|
190
|
-
entityType: 'assortment'
|
|
191
|
-
};
|
|
192
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
|
|
193
|
-
expect(defaultIdentifiers).toContain('seasonGroupName');
|
|
194
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
195
|
-
});
|
|
196
|
-
it('assortment - publishToFlexPLM=true', () => {
|
|
197
|
-
const newData = {
|
|
198
|
-
entityType: 'assortment',
|
|
199
|
-
publishToFlexPLM: true
|
|
200
|
-
};
|
|
201
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
|
|
202
|
-
expect(defaultIdentifiers).toContain('flexPLMSeasonName');
|
|
203
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
204
|
-
});
|
|
205
|
-
it('assortment - flex2vibeMapKeyRoot=LCSSeason', () => {
|
|
206
|
-
const newData = {
|
|
207
|
-
entityType: 'assortment',
|
|
208
|
-
flex2vibeMapKeyRoot: 'LCSSeason'
|
|
209
|
-
};
|
|
210
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
|
|
211
|
-
expect(defaultIdentifiers).toContain('flexPLMSeasonName');
|
|
212
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
213
|
-
});
|
|
214
|
-
it('color', () => {
|
|
215
|
-
const newData = {
|
|
216
|
-
entityType: 'color'
|
|
217
|
-
};
|
|
218
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
|
|
219
|
-
expect(defaultIdentifiers).toContain('name');
|
|
220
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
221
|
-
});
|
|
222
|
-
it('custom-entity', () => {
|
|
223
|
-
const newData = {
|
|
224
|
-
entityType: 'custom-entity'
|
|
225
|
-
};
|
|
226
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
|
|
227
|
-
expect(defaultIdentifiers).toContain('name');
|
|
228
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
describe('getDefaultInformationalProperties', () => {
|
|
232
|
-
it('item-family', () => {
|
|
233
|
-
const newData = {
|
|
234
|
-
entityType: 'item',
|
|
235
|
-
roles: ['family']
|
|
236
|
-
};
|
|
237
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
|
|
238
|
-
expect(defaultIdentifiers).toContain('name');
|
|
239
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
240
|
-
});
|
|
241
|
-
it('item-color', () => {
|
|
242
|
-
const newData = {
|
|
243
|
-
entityType: 'item',
|
|
244
|
-
roles: ['color']
|
|
245
|
-
};
|
|
246
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
|
|
247
|
-
expect(defaultIdentifiers).toContain('optionName');
|
|
248
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
249
|
-
});
|
|
250
|
-
it('project', () => {
|
|
251
|
-
const newData = {
|
|
252
|
-
entityType: 'project'
|
|
253
|
-
};
|
|
254
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
|
|
255
|
-
expect(defaultIdentifiers).toContain('name');
|
|
256
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
257
|
-
});
|
|
258
|
-
it('assortment', () => {
|
|
259
|
-
const newData = {
|
|
260
|
-
entityType: 'assortment'
|
|
261
|
-
};
|
|
262
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
|
|
263
|
-
expect(defaultIdentifiers).toContain('name');
|
|
264
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
265
|
-
});
|
|
266
|
-
it('color', () => {
|
|
267
|
-
const newData = {
|
|
268
|
-
entityType: 'color'
|
|
269
|
-
};
|
|
270
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
|
|
271
|
-
expect(defaultIdentifiers).toHaveLength(0);
|
|
272
|
-
});
|
|
273
|
-
it('custom-entity', () => {
|
|
274
|
-
const newData = {
|
|
275
|
-
entityType: 'custom-entity'
|
|
276
|
-
};
|
|
277
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
|
|
278
|
-
expect(defaultIdentifiers).toHaveLength(0);
|
|
279
|
-
});
|
|
280
|
-
});
|
|
281
|
-
describe('getEntityType', () => {
|
|
282
|
-
it('entityType', () => {
|
|
283
|
-
const entityType = 'item';
|
|
284
|
-
const entity = {
|
|
285
|
-
entityType
|
|
286
|
-
};
|
|
287
|
-
const results = type_defaults_1.TypeDefaults.getEntityType(entity);
|
|
288
|
-
expect(results).toEqual(entityType);
|
|
289
|
-
});
|
|
290
|
-
it('entityType from type path', () => {
|
|
291
|
-
const entityType = 'item';
|
|
292
|
-
const typePath = 'item:product:apparel';
|
|
293
|
-
const entity = {
|
|
294
|
-
typePath: typePath
|
|
295
|
-
};
|
|
296
|
-
const results = type_defaults_1.TypeDefaults.getEntityType(entity);
|
|
297
|
-
expect(results).toEqual(entityType);
|
|
298
|
-
});
|
|
299
|
-
it('No entityType', () => {
|
|
300
|
-
const typePath = 'item:product:apparel';
|
|
301
|
-
const entity = {
|
|
302
|
-
someValue: typePath
|
|
303
|
-
};
|
|
304
|
-
expect(() => type_defaults_1.TypeDefaults.getEntityType(entity)).toThrowError();
|
|
305
|
-
expect(() => type_defaults_1.TypeDefaults.getEntityType(entity)).toThrow(type_defaults_1.TypeDefaults.NO_ENTITY_TYPE);
|
|
306
|
-
});
|
|
307
|
-
});
|
|
308
|
-
describe('getDefaultEntityClass', () => {
|
|
309
|
-
it('item - LCSProduct', () => {
|
|
310
|
-
const object = {
|
|
311
|
-
flexPLMObjectClass: 'LCSProduct'
|
|
312
|
-
};
|
|
313
|
-
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
314
|
-
expect(entityClass).toBe('item');
|
|
315
|
-
});
|
|
316
|
-
it('item - LCSSKU', () => {
|
|
317
|
-
const object = {
|
|
318
|
-
flexPLMObjectClass: 'LCSSKU'
|
|
319
|
-
};
|
|
320
|
-
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
321
|
-
expect(entityClass).toBe('item');
|
|
322
|
-
});
|
|
323
|
-
it('project-item - LCSProductSeasonLink', () => {
|
|
324
|
-
const object = {
|
|
325
|
-
flexPLMObjectClass: 'LCSProductSeasonLink'
|
|
326
|
-
};
|
|
327
|
-
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
328
|
-
expect(entityClass).toBe('project-item');
|
|
329
|
-
});
|
|
330
|
-
it('project-item - LCSSKUSeasonLink', () => {
|
|
331
|
-
const object = {
|
|
332
|
-
flexPLMObjectClass: 'LCSSKUSeasonLink'
|
|
333
|
-
};
|
|
334
|
-
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
335
|
-
expect(entityClass).toBe('project-item');
|
|
336
|
-
});
|
|
337
|
-
it('color - LCSColor', () => {
|
|
338
|
-
const object = {
|
|
339
|
-
flexPLMObjectClass: 'LCSColor'
|
|
340
|
-
};
|
|
341
|
-
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
342
|
-
expect(entityClass).toBe('color');
|
|
343
|
-
});
|
|
344
|
-
it('assortment - LCSSeason', () => {
|
|
345
|
-
const object = {
|
|
346
|
-
flexPLMObjectClass: 'LCSSeason'
|
|
347
|
-
};
|
|
348
|
-
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
349
|
-
expect(entityClass).toBe('assortment');
|
|
350
|
-
});
|
|
351
|
-
it('assortment - SeasonGroup', () => {
|
|
352
|
-
const object = {
|
|
353
|
-
flexPLMObjectClass: 'SeasonGroup'
|
|
354
|
-
};
|
|
355
|
-
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
356
|
-
expect(entityClass).toBe('assortment');
|
|
357
|
-
});
|
|
358
|
-
it('custom-entity - LCSRevisableEntity', () => {
|
|
359
|
-
const object = {
|
|
360
|
-
flexPLMObjectClass: 'LCSRevisableEntity'
|
|
361
|
-
};
|
|
362
|
-
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
363
|
-
expect(entityClass).toBe('custom-entity');
|
|
364
|
-
});
|
|
365
|
-
it('custom-entity - LCSLifecycleManaged', () => {
|
|
366
|
-
const object = {
|
|
367
|
-
flexPLMObjectClass: 'LCSLifecycleManaged'
|
|
368
|
-
};
|
|
369
|
-
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
370
|
-
expect(entityClass).toBe('custom-entity');
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
describe('getDefaultEntityTypePath', () => {
|
|
374
|
-
it('LCSProduct', () => {
|
|
375
|
-
const object = {
|
|
376
|
-
flexPLMObjectClass: 'LCSProduct'
|
|
377
|
-
};
|
|
378
|
-
const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
|
|
379
|
-
expect(typePath).toBe('item');
|
|
380
|
-
});
|
|
381
|
-
it('LCSSKU', () => {
|
|
382
|
-
const object = {
|
|
383
|
-
flexPLMObjectClass: 'LCSSKU'
|
|
384
|
-
};
|
|
385
|
-
const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
|
|
386
|
-
expect(typePath).toBe('item');
|
|
387
|
-
});
|
|
388
|
-
it('LCSProductSeasonLink', () => {
|
|
389
|
-
const object = {
|
|
390
|
-
flexPLMObjectClass: 'LCSProductSeasonLink'
|
|
391
|
-
};
|
|
392
|
-
const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
|
|
393
|
-
expect(typePath).toBe('project-item');
|
|
394
|
-
});
|
|
395
|
-
it('LCSSKUSeasonLink', () => {
|
|
396
|
-
const object = {
|
|
397
|
-
flexPLMObjectClass: 'LCSSKUSeasonLink'
|
|
398
|
-
};
|
|
399
|
-
const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
|
|
400
|
-
expect(typePath).toBe('project-item');
|
|
401
|
-
});
|
|
402
|
-
it('LCSColor', () => {
|
|
403
|
-
const object = {
|
|
404
|
-
flexPLMObjectClass: 'LCSColor'
|
|
405
|
-
};
|
|
406
|
-
const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
|
|
407
|
-
expect(typePath).toBe('color');
|
|
408
|
-
});
|
|
409
|
-
it('LCSSeason', () => {
|
|
410
|
-
const object = {
|
|
411
|
-
flexPLMObjectClass: 'LCSSeason'
|
|
412
|
-
};
|
|
413
|
-
const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
|
|
414
|
-
expect(typePath).toBe('assortment');
|
|
415
|
-
});
|
|
416
|
-
it('SeasonGroup', () => {
|
|
417
|
-
const object = {
|
|
418
|
-
flexPLMObjectClass: 'SeasonGroup'
|
|
419
|
-
};
|
|
420
|
-
const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
|
|
421
|
-
expect(typePath).toBe('assortment');
|
|
422
|
-
});
|
|
423
|
-
});
|
|
424
|
-
describe('getDefaultIdentifierPropertiesFromObject', () => {
|
|
425
|
-
it('LCSProduct', () => {
|
|
426
|
-
const object = {
|
|
427
|
-
flexPLMObjectClass: 'LCSProduct'
|
|
428
|
-
};
|
|
429
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
|
|
430
|
-
expect(defaultIdentifiers).toContain('itemNumber');
|
|
431
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
432
|
-
});
|
|
433
|
-
it('LCSSKU', () => {
|
|
434
|
-
const object = {
|
|
435
|
-
flexPLMObjectClass: 'LCSSKU'
|
|
436
|
-
};
|
|
437
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
|
|
438
|
-
expect(defaultIdentifiers).toContain('itemNumber');
|
|
439
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
440
|
-
});
|
|
441
|
-
it('LCSSeason', () => {
|
|
442
|
-
const object = {
|
|
443
|
-
flexPLMObjectClass: 'LCSSeason'
|
|
444
|
-
};
|
|
445
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
|
|
446
|
-
expect(defaultIdentifiers).toContain('flexPLMSeasonName');
|
|
447
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
448
|
-
});
|
|
449
|
-
it('SeasonGroup', () => {
|
|
450
|
-
const object = {
|
|
451
|
-
flexPLMObjectClass: 'SeasonGroup'
|
|
452
|
-
};
|
|
453
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
|
|
454
|
-
expect(defaultIdentifiers).toContain('seasonGroupName');
|
|
455
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
456
|
-
});
|
|
457
|
-
it('LCSColor', () => {
|
|
458
|
-
const object = {
|
|
459
|
-
flexPLMObjectClass: 'LCSColor'
|
|
460
|
-
};
|
|
461
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
|
|
462
|
-
expect(defaultIdentifiers).toContain('name');
|
|
463
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
464
|
-
});
|
|
465
|
-
it('LCSRevisableEntity', () => {
|
|
466
|
-
const object = {
|
|
467
|
-
flexPLMObjectClass: 'LCSRevisableEntity'
|
|
468
|
-
};
|
|
469
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
|
|
470
|
-
expect(defaultIdentifiers).toContain('name');
|
|
471
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
472
|
-
});
|
|
473
|
-
it('LCSLifecycleManaged', () => {
|
|
474
|
-
const object = {
|
|
475
|
-
flexPLMObjectClass: 'LCSLifecycleManaged'
|
|
476
|
-
};
|
|
477
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
|
|
478
|
-
expect(defaultIdentifiers).toContain('name');
|
|
479
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
480
|
-
});
|
|
481
|
-
});
|
|
482
|
-
describe('getDefaultInformationalPropertiesFromObject', () => {
|
|
483
|
-
it('LCSProduct', () => {
|
|
484
|
-
const object = {
|
|
485
|
-
flexPLMObjectClass: 'LCSProduct'
|
|
486
|
-
};
|
|
487
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
|
|
488
|
-
expect(defaultIdentifiers).toContain('name');
|
|
489
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
490
|
-
});
|
|
491
|
-
it('LCSSKU', () => {
|
|
492
|
-
const object = {
|
|
493
|
-
flexPLMObjectClass: 'LCSSKU'
|
|
494
|
-
};
|
|
495
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
|
|
496
|
-
expect(defaultIdentifiers).toContain('optionName');
|
|
497
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
498
|
-
});
|
|
499
|
-
it('LCSSeason', () => {
|
|
500
|
-
const object = {
|
|
501
|
-
flexPLMObjectClass: 'LCSSeason'
|
|
502
|
-
};
|
|
503
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
|
|
504
|
-
expect(defaultIdentifiers).toContain('name');
|
|
505
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
506
|
-
});
|
|
507
|
-
it('SeasonGroup', () => {
|
|
508
|
-
const object = {
|
|
509
|
-
flexPLMObjectClass: 'SeasonGroup'
|
|
510
|
-
};
|
|
511
|
-
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
|
|
512
|
-
expect(defaultIdentifiers).toContain('name');
|
|
513
|
-
expect(defaultIdentifiers).toHaveLength(1);
|
|
514
|
-
});
|
|
515
|
-
});
|
|
516
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const type_defaults_1 = require("./type-defaults");
|
|
4
|
+
describe('Type Defaults', () => {
|
|
5
|
+
describe('getDefaultObjectClass', () => {
|
|
6
|
+
it('LCSProduct', () => {
|
|
7
|
+
const newData = {
|
|
8
|
+
entityType: 'item',
|
|
9
|
+
roles: ['family']
|
|
10
|
+
};
|
|
11
|
+
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
12
|
+
expect(objectClass).toEqual('LCSProduct');
|
|
13
|
+
});
|
|
14
|
+
it('LCSSKU', () => {
|
|
15
|
+
const newData = {
|
|
16
|
+
entityType: 'item',
|
|
17
|
+
roles: ['color']
|
|
18
|
+
};
|
|
19
|
+
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
20
|
+
expect(objectClass).toEqual('LCSSKU');
|
|
21
|
+
});
|
|
22
|
+
it('LCSProductSeasonLink', () => {
|
|
23
|
+
const newData = {
|
|
24
|
+
entityType: 'project-item',
|
|
25
|
+
roles: ['family']
|
|
26
|
+
};
|
|
27
|
+
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
28
|
+
expect(objectClass).toEqual('LCSProductSeasonLink');
|
|
29
|
+
});
|
|
30
|
+
it('LCSSKUSeasonLink', () => {
|
|
31
|
+
const newData = {
|
|
32
|
+
entityType: 'project-item',
|
|
33
|
+
roles: ['color']
|
|
34
|
+
};
|
|
35
|
+
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
36
|
+
expect(objectClass).toEqual('LCSSKUSeasonLink');
|
|
37
|
+
});
|
|
38
|
+
it('LCSColor', () => {
|
|
39
|
+
const newData = {
|
|
40
|
+
entityType: 'color'
|
|
41
|
+
};
|
|
42
|
+
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
43
|
+
expect(objectClass).toEqual('LCSColor');
|
|
44
|
+
});
|
|
45
|
+
it('LCSRevisableEntity', () => {
|
|
46
|
+
const newData = {
|
|
47
|
+
entityType: 'custom-entity'
|
|
48
|
+
};
|
|
49
|
+
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
50
|
+
expect(objectClass).toEqual('LCSRevisableEntity');
|
|
51
|
+
});
|
|
52
|
+
it('LCSSeason - project', () => {
|
|
53
|
+
const newData = {
|
|
54
|
+
entityType: 'project'
|
|
55
|
+
};
|
|
56
|
+
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
57
|
+
expect(objectClass).toEqual('LCSSeason');
|
|
58
|
+
});
|
|
59
|
+
it('Season Group', () => {
|
|
60
|
+
const newData = {
|
|
61
|
+
entityType: 'assortment'
|
|
62
|
+
};
|
|
63
|
+
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
64
|
+
expect(objectClass).toEqual('SeasonGroup');
|
|
65
|
+
});
|
|
66
|
+
it('LCSSeason - assortment - publishToFlexPLM=true', () => {
|
|
67
|
+
const newData = {
|
|
68
|
+
entityType: 'assortment',
|
|
69
|
+
publishToFlexPLM: true
|
|
70
|
+
};
|
|
71
|
+
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
72
|
+
expect(objectClass).toEqual('LCSSeason');
|
|
73
|
+
});
|
|
74
|
+
it('LCSSeason - assortment - publishToFlexPLM=true', () => {
|
|
75
|
+
const newData = {
|
|
76
|
+
entityType: 'assortment',
|
|
77
|
+
flex2vibeMapKeyRoot: 'LCSSeason'
|
|
78
|
+
};
|
|
79
|
+
const objectClass = type_defaults_1.TypeDefaults.getDefaultObjectClass(newData);
|
|
80
|
+
expect(objectClass).toEqual('LCSSeason');
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
describe('getDefaultObjectTypePath', () => {
|
|
84
|
+
it('item-family', () => {
|
|
85
|
+
const newData = {
|
|
86
|
+
entityType: 'item',
|
|
87
|
+
roles: ['family']
|
|
88
|
+
};
|
|
89
|
+
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
90
|
+
expect(typePath).toEqual('Product');
|
|
91
|
+
});
|
|
92
|
+
it('item-color', () => {
|
|
93
|
+
const newData = {
|
|
94
|
+
entityType: 'item',
|
|
95
|
+
roles: ['color']
|
|
96
|
+
};
|
|
97
|
+
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
98
|
+
expect(typePath).toEqual('Product');
|
|
99
|
+
});
|
|
100
|
+
it('project-item-family', () => {
|
|
101
|
+
const newData = {
|
|
102
|
+
entityType: 'project-item',
|
|
103
|
+
roles: ['family']
|
|
104
|
+
};
|
|
105
|
+
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
106
|
+
expect(typePath).toEqual('Product');
|
|
107
|
+
});
|
|
108
|
+
it('project-item-color', () => {
|
|
109
|
+
const newData = {
|
|
110
|
+
entityType: 'project-item',
|
|
111
|
+
roles: ['color']
|
|
112
|
+
};
|
|
113
|
+
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
114
|
+
expect(typePath).toEqual('Product');
|
|
115
|
+
});
|
|
116
|
+
it('color', () => {
|
|
117
|
+
const newData = {
|
|
118
|
+
entityType: 'color'
|
|
119
|
+
};
|
|
120
|
+
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
121
|
+
expect(typePath).toEqual('Color');
|
|
122
|
+
});
|
|
123
|
+
it('custom-entity', () => {
|
|
124
|
+
const newData = {
|
|
125
|
+
entityType: 'custom-entity'
|
|
126
|
+
};
|
|
127
|
+
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
128
|
+
expect(typePath).toEqual('Revisable Entity');
|
|
129
|
+
});
|
|
130
|
+
it('project', () => {
|
|
131
|
+
const newData = {
|
|
132
|
+
entityType: 'project'
|
|
133
|
+
};
|
|
134
|
+
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
135
|
+
expect(typePath).toEqual('Season');
|
|
136
|
+
});
|
|
137
|
+
it('assortment', () => {
|
|
138
|
+
const newData = {
|
|
139
|
+
entityType: 'assortment'
|
|
140
|
+
};
|
|
141
|
+
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
142
|
+
expect(typePath).toEqual('Season Group');
|
|
143
|
+
});
|
|
144
|
+
it('assortment - publishToFlexPLM=true', () => {
|
|
145
|
+
const newData = {
|
|
146
|
+
entityType: 'assortment',
|
|
147
|
+
publishToFlexPLM: true
|
|
148
|
+
};
|
|
149
|
+
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
150
|
+
expect(typePath).toEqual('Season');
|
|
151
|
+
});
|
|
152
|
+
it('assortment - flex2vibeMapKeyRoot=LCSSeason', () => {
|
|
153
|
+
const newData = {
|
|
154
|
+
entityType: 'assortment',
|
|
155
|
+
flex2vibeMapKeyRoot: 'LCSSeason'
|
|
156
|
+
};
|
|
157
|
+
const typePath = type_defaults_1.TypeDefaults.getDefaultObjectTypePath(newData);
|
|
158
|
+
expect(typePath).toEqual('Season');
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
describe('getDefaultIdentifiers', () => {
|
|
162
|
+
it('item-family', () => {
|
|
163
|
+
const newData = {
|
|
164
|
+
entityType: 'item',
|
|
165
|
+
roles: ['family']
|
|
166
|
+
};
|
|
167
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
|
|
168
|
+
expect(defaultIdentifiers).toContain('itemNumber');
|
|
169
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
170
|
+
});
|
|
171
|
+
it('item-color', () => {
|
|
172
|
+
const newData = {
|
|
173
|
+
entityType: 'item',
|
|
174
|
+
roles: ['color']
|
|
175
|
+
};
|
|
176
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
|
|
177
|
+
expect(defaultIdentifiers).toContain('itemNumber');
|
|
178
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
179
|
+
});
|
|
180
|
+
it('project', () => {
|
|
181
|
+
const newData = {
|
|
182
|
+
entityType: 'project'
|
|
183
|
+
};
|
|
184
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
|
|
185
|
+
expect(defaultIdentifiers).toContain('flexPLMSeasonName');
|
|
186
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
187
|
+
});
|
|
188
|
+
it('assortment', () => {
|
|
189
|
+
const newData = {
|
|
190
|
+
entityType: 'assortment'
|
|
191
|
+
};
|
|
192
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
|
|
193
|
+
expect(defaultIdentifiers).toContain('seasonGroupName');
|
|
194
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
195
|
+
});
|
|
196
|
+
it('assortment - publishToFlexPLM=true', () => {
|
|
197
|
+
const newData = {
|
|
198
|
+
entityType: 'assortment',
|
|
199
|
+
publishToFlexPLM: true
|
|
200
|
+
};
|
|
201
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
|
|
202
|
+
expect(defaultIdentifiers).toContain('flexPLMSeasonName');
|
|
203
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
204
|
+
});
|
|
205
|
+
it('assortment - flex2vibeMapKeyRoot=LCSSeason', () => {
|
|
206
|
+
const newData = {
|
|
207
|
+
entityType: 'assortment',
|
|
208
|
+
flex2vibeMapKeyRoot: 'LCSSeason'
|
|
209
|
+
};
|
|
210
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
|
|
211
|
+
expect(defaultIdentifiers).toContain('flexPLMSeasonName');
|
|
212
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
213
|
+
});
|
|
214
|
+
it('color', () => {
|
|
215
|
+
const newData = {
|
|
216
|
+
entityType: 'color'
|
|
217
|
+
};
|
|
218
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
|
|
219
|
+
expect(defaultIdentifiers).toContain('name');
|
|
220
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
221
|
+
});
|
|
222
|
+
it('custom-entity', () => {
|
|
223
|
+
const newData = {
|
|
224
|
+
entityType: 'custom-entity'
|
|
225
|
+
};
|
|
226
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierProperties(newData);
|
|
227
|
+
expect(defaultIdentifiers).toContain('name');
|
|
228
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
describe('getDefaultInformationalProperties', () => {
|
|
232
|
+
it('item-family', () => {
|
|
233
|
+
const newData = {
|
|
234
|
+
entityType: 'item',
|
|
235
|
+
roles: ['family']
|
|
236
|
+
};
|
|
237
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
|
|
238
|
+
expect(defaultIdentifiers).toContain('name');
|
|
239
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
240
|
+
});
|
|
241
|
+
it('item-color', () => {
|
|
242
|
+
const newData = {
|
|
243
|
+
entityType: 'item',
|
|
244
|
+
roles: ['color']
|
|
245
|
+
};
|
|
246
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
|
|
247
|
+
expect(defaultIdentifiers).toContain('optionName');
|
|
248
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
249
|
+
});
|
|
250
|
+
it('project', () => {
|
|
251
|
+
const newData = {
|
|
252
|
+
entityType: 'project'
|
|
253
|
+
};
|
|
254
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
|
|
255
|
+
expect(defaultIdentifiers).toContain('name');
|
|
256
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
257
|
+
});
|
|
258
|
+
it('assortment', () => {
|
|
259
|
+
const newData = {
|
|
260
|
+
entityType: 'assortment'
|
|
261
|
+
};
|
|
262
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
|
|
263
|
+
expect(defaultIdentifiers).toContain('name');
|
|
264
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
265
|
+
});
|
|
266
|
+
it('color', () => {
|
|
267
|
+
const newData = {
|
|
268
|
+
entityType: 'color'
|
|
269
|
+
};
|
|
270
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
|
|
271
|
+
expect(defaultIdentifiers).toHaveLength(0);
|
|
272
|
+
});
|
|
273
|
+
it('custom-entity', () => {
|
|
274
|
+
const newData = {
|
|
275
|
+
entityType: 'custom-entity'
|
|
276
|
+
};
|
|
277
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalProperties(newData);
|
|
278
|
+
expect(defaultIdentifiers).toHaveLength(0);
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
describe('getEntityType', () => {
|
|
282
|
+
it('entityType', () => {
|
|
283
|
+
const entityType = 'item';
|
|
284
|
+
const entity = {
|
|
285
|
+
entityType
|
|
286
|
+
};
|
|
287
|
+
const results = type_defaults_1.TypeDefaults.getEntityType(entity);
|
|
288
|
+
expect(results).toEqual(entityType);
|
|
289
|
+
});
|
|
290
|
+
it('entityType from type path', () => {
|
|
291
|
+
const entityType = 'item';
|
|
292
|
+
const typePath = 'item:product:apparel';
|
|
293
|
+
const entity = {
|
|
294
|
+
typePath: typePath
|
|
295
|
+
};
|
|
296
|
+
const results = type_defaults_1.TypeDefaults.getEntityType(entity);
|
|
297
|
+
expect(results).toEqual(entityType);
|
|
298
|
+
});
|
|
299
|
+
it('No entityType', () => {
|
|
300
|
+
const typePath = 'item:product:apparel';
|
|
301
|
+
const entity = {
|
|
302
|
+
someValue: typePath
|
|
303
|
+
};
|
|
304
|
+
expect(() => type_defaults_1.TypeDefaults.getEntityType(entity)).toThrowError();
|
|
305
|
+
expect(() => type_defaults_1.TypeDefaults.getEntityType(entity)).toThrow(type_defaults_1.TypeDefaults.NO_ENTITY_TYPE);
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
describe('getDefaultEntityClass', () => {
|
|
309
|
+
it('item - LCSProduct', () => {
|
|
310
|
+
const object = {
|
|
311
|
+
flexPLMObjectClass: 'LCSProduct'
|
|
312
|
+
};
|
|
313
|
+
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
314
|
+
expect(entityClass).toBe('item');
|
|
315
|
+
});
|
|
316
|
+
it('item - LCSSKU', () => {
|
|
317
|
+
const object = {
|
|
318
|
+
flexPLMObjectClass: 'LCSSKU'
|
|
319
|
+
};
|
|
320
|
+
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
321
|
+
expect(entityClass).toBe('item');
|
|
322
|
+
});
|
|
323
|
+
it('project-item - LCSProductSeasonLink', () => {
|
|
324
|
+
const object = {
|
|
325
|
+
flexPLMObjectClass: 'LCSProductSeasonLink'
|
|
326
|
+
};
|
|
327
|
+
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
328
|
+
expect(entityClass).toBe('project-item');
|
|
329
|
+
});
|
|
330
|
+
it('project-item - LCSSKUSeasonLink', () => {
|
|
331
|
+
const object = {
|
|
332
|
+
flexPLMObjectClass: 'LCSSKUSeasonLink'
|
|
333
|
+
};
|
|
334
|
+
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
335
|
+
expect(entityClass).toBe('project-item');
|
|
336
|
+
});
|
|
337
|
+
it('color - LCSColor', () => {
|
|
338
|
+
const object = {
|
|
339
|
+
flexPLMObjectClass: 'LCSColor'
|
|
340
|
+
};
|
|
341
|
+
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
342
|
+
expect(entityClass).toBe('color');
|
|
343
|
+
});
|
|
344
|
+
it('assortment - LCSSeason', () => {
|
|
345
|
+
const object = {
|
|
346
|
+
flexPLMObjectClass: 'LCSSeason'
|
|
347
|
+
};
|
|
348
|
+
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
349
|
+
expect(entityClass).toBe('assortment');
|
|
350
|
+
});
|
|
351
|
+
it('assortment - SeasonGroup', () => {
|
|
352
|
+
const object = {
|
|
353
|
+
flexPLMObjectClass: 'SeasonGroup'
|
|
354
|
+
};
|
|
355
|
+
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
356
|
+
expect(entityClass).toBe('assortment');
|
|
357
|
+
});
|
|
358
|
+
it('custom-entity - LCSRevisableEntity', () => {
|
|
359
|
+
const object = {
|
|
360
|
+
flexPLMObjectClass: 'LCSRevisableEntity'
|
|
361
|
+
};
|
|
362
|
+
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
363
|
+
expect(entityClass).toBe('custom-entity');
|
|
364
|
+
});
|
|
365
|
+
it('custom-entity - LCSLifecycleManaged', () => {
|
|
366
|
+
const object = {
|
|
367
|
+
flexPLMObjectClass: 'LCSLifecycleManaged'
|
|
368
|
+
};
|
|
369
|
+
const entityClass = type_defaults_1.TypeDefaults.getDefaultEntityClass(object);
|
|
370
|
+
expect(entityClass).toBe('custom-entity');
|
|
371
|
+
});
|
|
372
|
+
});
|
|
373
|
+
describe('getDefaultEntityTypePath', () => {
|
|
374
|
+
it('LCSProduct', () => {
|
|
375
|
+
const object = {
|
|
376
|
+
flexPLMObjectClass: 'LCSProduct'
|
|
377
|
+
};
|
|
378
|
+
const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
|
|
379
|
+
expect(typePath).toBe('item');
|
|
380
|
+
});
|
|
381
|
+
it('LCSSKU', () => {
|
|
382
|
+
const object = {
|
|
383
|
+
flexPLMObjectClass: 'LCSSKU'
|
|
384
|
+
};
|
|
385
|
+
const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
|
|
386
|
+
expect(typePath).toBe('item');
|
|
387
|
+
});
|
|
388
|
+
it('LCSProductSeasonLink', () => {
|
|
389
|
+
const object = {
|
|
390
|
+
flexPLMObjectClass: 'LCSProductSeasonLink'
|
|
391
|
+
};
|
|
392
|
+
const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
|
|
393
|
+
expect(typePath).toBe('project-item');
|
|
394
|
+
});
|
|
395
|
+
it('LCSSKUSeasonLink', () => {
|
|
396
|
+
const object = {
|
|
397
|
+
flexPLMObjectClass: 'LCSSKUSeasonLink'
|
|
398
|
+
};
|
|
399
|
+
const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
|
|
400
|
+
expect(typePath).toBe('project-item');
|
|
401
|
+
});
|
|
402
|
+
it('LCSColor', () => {
|
|
403
|
+
const object = {
|
|
404
|
+
flexPLMObjectClass: 'LCSColor'
|
|
405
|
+
};
|
|
406
|
+
const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
|
|
407
|
+
expect(typePath).toBe('color');
|
|
408
|
+
});
|
|
409
|
+
it('LCSSeason', () => {
|
|
410
|
+
const object = {
|
|
411
|
+
flexPLMObjectClass: 'LCSSeason'
|
|
412
|
+
};
|
|
413
|
+
const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
|
|
414
|
+
expect(typePath).toBe('assortment');
|
|
415
|
+
});
|
|
416
|
+
it('SeasonGroup', () => {
|
|
417
|
+
const object = {
|
|
418
|
+
flexPLMObjectClass: 'SeasonGroup'
|
|
419
|
+
};
|
|
420
|
+
const typePath = type_defaults_1.TypeDefaults.getDefaultEntityTypePath(object);
|
|
421
|
+
expect(typePath).toBe('assortment');
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
describe('getDefaultIdentifierPropertiesFromObject', () => {
|
|
425
|
+
it('LCSProduct', () => {
|
|
426
|
+
const object = {
|
|
427
|
+
flexPLMObjectClass: 'LCSProduct'
|
|
428
|
+
};
|
|
429
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
|
|
430
|
+
expect(defaultIdentifiers).toContain('itemNumber');
|
|
431
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
432
|
+
});
|
|
433
|
+
it('LCSSKU', () => {
|
|
434
|
+
const object = {
|
|
435
|
+
flexPLMObjectClass: 'LCSSKU'
|
|
436
|
+
};
|
|
437
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
|
|
438
|
+
expect(defaultIdentifiers).toContain('itemNumber');
|
|
439
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
440
|
+
});
|
|
441
|
+
it('LCSSeason', () => {
|
|
442
|
+
const object = {
|
|
443
|
+
flexPLMObjectClass: 'LCSSeason'
|
|
444
|
+
};
|
|
445
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
|
|
446
|
+
expect(defaultIdentifiers).toContain('flexPLMSeasonName');
|
|
447
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
448
|
+
});
|
|
449
|
+
it('SeasonGroup', () => {
|
|
450
|
+
const object = {
|
|
451
|
+
flexPLMObjectClass: 'SeasonGroup'
|
|
452
|
+
};
|
|
453
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
|
|
454
|
+
expect(defaultIdentifiers).toContain('seasonGroupName');
|
|
455
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
456
|
+
});
|
|
457
|
+
it('LCSColor', () => {
|
|
458
|
+
const object = {
|
|
459
|
+
flexPLMObjectClass: 'LCSColor'
|
|
460
|
+
};
|
|
461
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
|
|
462
|
+
expect(defaultIdentifiers).toContain('name');
|
|
463
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
464
|
+
});
|
|
465
|
+
it('LCSRevisableEntity', () => {
|
|
466
|
+
const object = {
|
|
467
|
+
flexPLMObjectClass: 'LCSRevisableEntity'
|
|
468
|
+
};
|
|
469
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
|
|
470
|
+
expect(defaultIdentifiers).toContain('name');
|
|
471
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
472
|
+
});
|
|
473
|
+
it('LCSLifecycleManaged', () => {
|
|
474
|
+
const object = {
|
|
475
|
+
flexPLMObjectClass: 'LCSLifecycleManaged'
|
|
476
|
+
};
|
|
477
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
|
|
478
|
+
expect(defaultIdentifiers).toContain('name');
|
|
479
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
480
|
+
});
|
|
481
|
+
});
|
|
482
|
+
describe('getDefaultInformationalPropertiesFromObject', () => {
|
|
483
|
+
it('LCSProduct', () => {
|
|
484
|
+
const object = {
|
|
485
|
+
flexPLMObjectClass: 'LCSProduct'
|
|
486
|
+
};
|
|
487
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
|
|
488
|
+
expect(defaultIdentifiers).toContain('name');
|
|
489
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
490
|
+
});
|
|
491
|
+
it('LCSSKU', () => {
|
|
492
|
+
const object = {
|
|
493
|
+
flexPLMObjectClass: 'LCSSKU'
|
|
494
|
+
};
|
|
495
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
|
|
496
|
+
expect(defaultIdentifiers).toContain('optionName');
|
|
497
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
498
|
+
});
|
|
499
|
+
it('LCSSeason', () => {
|
|
500
|
+
const object = {
|
|
501
|
+
flexPLMObjectClass: 'LCSSeason'
|
|
502
|
+
};
|
|
503
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
|
|
504
|
+
expect(defaultIdentifiers).toContain('name');
|
|
505
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
506
|
+
});
|
|
507
|
+
it('SeasonGroup', () => {
|
|
508
|
+
const object = {
|
|
509
|
+
flexPLMObjectClass: 'SeasonGroup'
|
|
510
|
+
};
|
|
511
|
+
const defaultIdentifiers = type_defaults_1.TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
|
|
512
|
+
expect(defaultIdentifiers).toContain('name');
|
|
513
|
+
expect(defaultIdentifiers).toHaveLength(1);
|
|
514
|
+
});
|
|
515
|
+
});
|
|
516
|
+
});
|