@contrail/flexplm 1.5.0-alpha.98b8b06 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/.github/pull_request_template.md +31 -0
  2. package/.github/workflows/flexplm-lib.yml +27 -0
  3. package/.github/workflows/publish-to-npm.yml +121 -0
  4. package/CHANGELOG.md +45 -0
  5. package/lib/entity-processor/base-entity-processor.d.ts +0 -65
  6. package/lib/entity-processor/base-entity-processor.js +0 -71
  7. package/lib/entity-processor/base-entity-processor.spec.js +0 -1
  8. package/lib/index.d.ts +0 -1
  9. package/lib/index.js +0 -1
  10. package/lib/publish/base-process-publish-assortment.d.ts +0 -25
  11. package/lib/publish/base-process-publish-assortment.js +6 -60
  12. package/lib/publish/base-process-publish-assortment.spec.js +4 -22
  13. package/lib/publish/mockData.js +0 -5
  14. package/lib/transform/identifier-conversion-spec-mockData.js +6 -34
  15. package/lib/transform/identifier-conversion.d.ts +0 -36
  16. package/lib/transform/identifier-conversion.js +0 -36
  17. package/lib/transform/identifier-conversion.spec.js +0 -4
  18. package/lib/util/config-defaults.js +0 -3
  19. package/lib/util/config-defaults.spec.js +0 -9
  20. package/lib/util/data-converter-spec-mockData.js +3 -17
  21. package/lib/util/data-converter.d.ts +0 -97
  22. package/lib/util/data-converter.js +1 -127
  23. package/lib/util/data-converter.spec.js +0 -2
  24. package/lib/util/error-response-object.d.ts +0 -5
  25. package/lib/util/error-response-object.js +0 -7
  26. package/lib/util/event-short-message-status.js +0 -1
  27. package/lib/util/federation.js +0 -8
  28. package/lib/util/flexplm-connect.d.ts +0 -7
  29. package/lib/util/flexplm-connect.js +0 -14
  30. package/lib/util/logger-config.js +0 -1
  31. package/lib/util/map-util-spec-mockData.js +3 -17
  32. package/lib/util/map-utils.d.ts +0 -27
  33. package/lib/util/map-utils.js +0 -27
  34. package/lib/util/thumbnail-util.d.ts +0 -21
  35. package/lib/util/thumbnail-util.js +1 -28
  36. package/lib/util/thumbnail-util.spec.js +0 -6
  37. package/lib/util/type-conversion-utils-spec-mockData.js +3 -3
  38. package/lib/util/type-conversion-utils.d.ts +1 -152
  39. package/lib/util/type-conversion-utils.js +1 -155
  40. package/lib/util/type-defaults.d.ts +0 -66
  41. package/lib/util/type-defaults.js +0 -66
  42. package/lib/util/type-defaults.spec.js +5 -5
  43. package/lib/util/type-utils.d.ts +0 -21
  44. package/lib/util/type-utils.js +0 -23
  45. package/lib/util/type-utils.spec.js +0 -2
  46. package/package.json +6 -21
  47. package/publish.bat +5 -0
  48. package/publish.sh +5 -0
  49. package/src/entity-processor/base-entity-processor.spec.ts +689 -0
  50. package/src/entity-processor/base-entity-processor.ts +583 -0
  51. package/src/flexplm-request.ts +28 -0
  52. package/src/flexplm-utils.spec.ts +27 -0
  53. package/src/flexplm-utils.ts +29 -0
  54. package/src/index.ts +22 -0
  55. package/src/interfaces/interfaces.ts +122 -0
  56. package/src/interfaces/item-family-changes.ts +67 -0
  57. package/src/interfaces/publish-change-data.ts +43 -0
  58. package/src/publish/base-process-publish-assortment-callback.ts +50 -0
  59. package/src/publish/base-process-publish-assortment.spec.ts +1992 -0
  60. package/src/publish/base-process-publish-assortment.ts +1134 -0
  61. package/src/publish/mockData.ts +4561 -0
  62. package/src/transform/identifier-conversion-spec-mockData.ts +496 -0
  63. package/src/transform/identifier-conversion.spec.ts +386 -0
  64. package/src/transform/identifier-conversion.ts +282 -0
  65. package/src/util/config-defaults.spec.ts +445 -0
  66. package/src/util/config-defaults.ts +106 -0
  67. package/src/util/data-converter-spec-mockData.ts +231 -0
  68. package/src/util/data-converter.spec.ts +1622 -0
  69. package/src/util/data-converter.ts +819 -0
  70. package/src/util/error-response-object.spec.ts +116 -0
  71. package/src/util/error-response-object.ts +50 -0
  72. package/src/util/event-short-message-status.ts +22 -0
  73. package/src/util/federation.ts +172 -0
  74. package/src/util/flexplm-connect.spec.ts +132 -0
  75. package/src/util/flexplm-connect.ts +208 -0
  76. package/src/util/logger-config.ts +20 -0
  77. package/src/util/map-util-spec-mockData.ts +231 -0
  78. package/src/util/map-utils.spec.ts +103 -0
  79. package/src/util/map-utils.ts +41 -0
  80. package/src/util/mockData.ts +101 -0
  81. package/src/util/thumbnail-util.spec.ts +508 -0
  82. package/src/util/thumbnail-util.ts +272 -0
  83. package/src/util/type-conversion-utils-spec-mockData.ts +272 -0
  84. package/src/util/type-conversion-utils.spec.ts +1031 -0
  85. package/src/util/type-conversion-utils.ts +490 -0
  86. package/src/util/type-defaults.spec.ts +797 -0
  87. package/src/util/type-defaults.ts +320 -0
  88. package/src/util/type-utils.spec.ts +227 -0
  89. package/src/util/type-utils.ts +144 -0
  90. package/tsconfig.json +24 -0
  91. package/tslint.json +57 -0
  92. package/lib/cli/commands/compile.d.ts +0 -4
  93. package/lib/cli/commands/compile.js +0 -73
  94. package/lib/cli/commands/compile.spec.d.ts +0 -1
  95. package/lib/cli/commands/compile.spec.js +0 -80
  96. package/lib/cli/commands/create.d.ts +0 -5
  97. package/lib/cli/commands/create.js +0 -77
  98. package/lib/cli/commands/create.spec.d.ts +0 -1
  99. package/lib/cli/commands/create.spec.js +0 -78
  100. package/lib/cli/commands/upload.d.ts +0 -17
  101. package/lib/cli/commands/upload.js +0 -228
  102. package/lib/cli/commands/upload.spec.d.ts +0 -1
  103. package/lib/cli/commands/upload.spec.js +0 -88
  104. package/lib/cli/index.d.ts +0 -5
  105. package/lib/cli/index.js +0 -70
  106. package/lib/cli/index.spec.d.ts +0 -1
  107. package/lib/cli/index.spec.js +0 -85
  108. package/lib/cli/template/mapping-template.ts.template +0 -62
  109. package/lib/interfaces/mapping-file.d.ts +0 -460
  110. package/lib/interfaces/mapping-file.js +0 -2
  111. package/scripts/copy-template.js +0 -10
@@ -0,0 +1,797 @@
1
+ import { MapFileUtil } from "@contrail/transform-data";
2
+ import { TypeDefaults } from "./type-defaults";
3
+ import { Entities } from "@contrail/sdk";
4
+
5
+ describe('Type Defaults', () =>{
6
+ describe('getDefaultObjectClass', () => {
7
+ it('LCSProduct', () => {
8
+ const newData = {
9
+ entityType: 'item',
10
+ roles: ['family']
11
+ };
12
+
13
+ const objectClass = TypeDefaults.getDefaultObjectClass(newData);
14
+
15
+ expect(objectClass).toEqual('LCSProduct');
16
+
17
+ });
18
+
19
+ it('LCSSKU', () => {
20
+ const newData = {
21
+ entityType: 'item',
22
+ roles: ['color']
23
+ };
24
+
25
+ const objectClass = TypeDefaults.getDefaultObjectClass(newData);
26
+
27
+ expect(objectClass).toEqual('LCSSKU');
28
+ });
29
+
30
+ it('LCSProductSeasonLink', () => {
31
+ const newData = {
32
+ entityType: 'project-item',
33
+ roles: ['family']
34
+ };
35
+
36
+ const objectClass = TypeDefaults.getDefaultObjectClass(newData);
37
+
38
+ expect(objectClass).toEqual('LCSProductSeasonLink');
39
+ });
40
+
41
+ it('LCSSKUSeasonLink', () => {
42
+ const newData = {
43
+ entityType: 'project-item',
44
+ roles: ['color']
45
+ };
46
+ const objectClass = TypeDefaults.getDefaultObjectClass(newData);
47
+
48
+ expect(objectClass).toEqual('LCSSKUSeasonLink');
49
+ });
50
+ it('LCSColor', () => {
51
+ const newData = {
52
+ entityType: 'color'
53
+ };
54
+
55
+ const objectClass = TypeDefaults.getDefaultObjectClass(newData);
56
+
57
+ expect(objectClass).toEqual('LCSColor');
58
+ });
59
+
60
+ it('LCSRevisableEntity', () => {
61
+ const newData = {
62
+ entityType: 'custom-entity'
63
+ };
64
+
65
+ const objectClass = TypeDefaults.getDefaultObjectClass(newData);
66
+
67
+ expect(objectClass).toEqual('LCSRevisableEntity');
68
+ });
69
+
70
+ it('LCSSeason - project', () => {
71
+ const newData = {
72
+ entityType: 'project'
73
+ };
74
+
75
+ const objectClass = TypeDefaults.getDefaultObjectClass(newData);
76
+
77
+ expect(objectClass).toEqual('LCSSeason');
78
+ });
79
+
80
+ it('Season Group', () => {
81
+ const newData = {
82
+ entityType: 'assortment'
83
+ };
84
+
85
+ const objectClass = TypeDefaults.getDefaultObjectClass(newData);
86
+
87
+ expect(objectClass).toEqual('SeasonGroup');
88
+ });
89
+
90
+ it('LCSSeason - assortment - publishToFlexPLM=true', () => {
91
+ const newData = {
92
+ entityType: 'assortment',
93
+ publishToFlexPLM: true
94
+ };
95
+
96
+ const objectClass = TypeDefaults.getDefaultObjectClass(newData);
97
+
98
+ expect(objectClass).toEqual('LCSSeason');
99
+ });
100
+
101
+ it('LCSSeason - assortment - publishToFlexPLM=true', () => {
102
+ const newData = {
103
+ entityType: 'assortment',
104
+ flex2vibeMapKeyRoot: 'LCSSeason'
105
+ };
106
+
107
+ const objectClass = TypeDefaults.getDefaultObjectClass(newData);
108
+
109
+ expect(objectClass).toEqual('LCSSeason');
110
+ });
111
+ });
112
+
113
+ describe('getDefaultObjectTypePath', () =>{
114
+ it('item-family', () =>{
115
+ const newData = {
116
+ entityType: 'item',
117
+ roles: ['family']
118
+ };
119
+
120
+ const typePath = TypeDefaults.getDefaultObjectTypePath(newData);
121
+ expect(typePath).toEqual('Product');
122
+ });
123
+
124
+ it('item-color', () =>{
125
+ const newData = {
126
+ entityType: 'item',
127
+ roles: ['color']
128
+ };
129
+
130
+ const typePath = TypeDefaults.getDefaultObjectTypePath(newData);
131
+ expect(typePath).toEqual('Product');
132
+ });
133
+
134
+ it('project-item-family', () =>{
135
+ const newData = {
136
+ entityType: 'project-item',
137
+ roles: ['family']
138
+ };
139
+
140
+ const typePath = TypeDefaults.getDefaultObjectTypePath(newData);
141
+ expect(typePath).toEqual('Product');
142
+ });
143
+
144
+ it('project-item-color', () =>{
145
+ const newData = {
146
+ entityType: 'project-item',
147
+ roles: ['color']
148
+ };
149
+
150
+ const typePath = TypeDefaults.getDefaultObjectTypePath(newData);
151
+ expect(typePath).toEqual('Product');
152
+ });
153
+
154
+ it('color', () =>{
155
+ const newData = {
156
+ entityType: 'color'
157
+ };
158
+
159
+ const typePath = TypeDefaults.getDefaultObjectTypePath(newData);
160
+ expect(typePath).toEqual('Color');
161
+ });
162
+
163
+ it('custom-entity', () =>{
164
+ const newData = {
165
+ entityType: 'custom-entity'
166
+ };
167
+
168
+ const typePath = TypeDefaults.getDefaultObjectTypePath(newData);
169
+ expect(typePath).toEqual('Revisable Entity');
170
+ });
171
+
172
+ it('project', () =>{
173
+ const newData = {
174
+ entityType: 'project'
175
+ };
176
+
177
+ const typePath = TypeDefaults.getDefaultObjectTypePath(newData);
178
+ expect(typePath).toEqual('Season');
179
+ });
180
+
181
+ it('assortment', () =>{
182
+ const newData = {
183
+ entityType: 'assortment'
184
+ };
185
+
186
+ const typePath = TypeDefaults.getDefaultObjectTypePath(newData);
187
+ expect(typePath).toEqual('Season Group');
188
+ });
189
+
190
+ it('assortment - publishToFlexPLM=true', () =>{
191
+ const newData = {
192
+ entityType: 'assortment',
193
+ publishToFlexPLM: true
194
+ };
195
+
196
+ const typePath = TypeDefaults.getDefaultObjectTypePath(newData);
197
+ expect(typePath).toEqual('Season');
198
+ });
199
+
200
+ it('assortment - flex2vibeMapKeyRoot=LCSSeason', () =>{
201
+ const newData = {
202
+ entityType: 'assortment',
203
+ flex2vibeMapKeyRoot: 'LCSSeason'
204
+ };
205
+
206
+ const typePath = TypeDefaults.getDefaultObjectTypePath(newData);
207
+ expect(typePath).toEqual('Season');
208
+ });
209
+ });
210
+
211
+ describe('getDefaultIdentifiers', () =>{
212
+ it('item-family', () =>{
213
+ const newData = {
214
+ entityType: 'item',
215
+ roles: ['family']
216
+ };
217
+
218
+ const defaultIdentifiers = TypeDefaults.getDefaultIdentifierProperties(newData);
219
+ expect(defaultIdentifiers).toContain('itemNumber');
220
+ expect(defaultIdentifiers).toHaveLength(1);
221
+ });
222
+
223
+ it('item-color', () =>{
224
+ const newData = {
225
+ entityType: 'item',
226
+ roles: ['color']
227
+ };
228
+
229
+ const defaultIdentifiers = TypeDefaults.getDefaultIdentifierProperties(newData);
230
+ expect(defaultIdentifiers).toContain('itemNumber');
231
+ expect(defaultIdentifiers).toHaveLength(1);
232
+ });
233
+
234
+ it('project', () =>{
235
+ const newData = {
236
+ entityType: 'project'
237
+ };
238
+
239
+ const defaultIdentifiers = TypeDefaults.getDefaultIdentifierProperties(newData);
240
+ expect(defaultIdentifiers).toContain('flexPLMSeasonName');
241
+ expect(defaultIdentifiers).toHaveLength(1);
242
+ });
243
+
244
+ it('assortment', () =>{
245
+ const newData = {
246
+ entityType: 'assortment'
247
+ };
248
+
249
+ const defaultIdentifiers = TypeDefaults.getDefaultIdentifierProperties(newData);
250
+ expect(defaultIdentifiers).toContain('seasonGroupName');
251
+ expect(defaultIdentifiers).toHaveLength(1);
252
+ });
253
+
254
+ it('assortment - publishToFlexPLM=true', () =>{
255
+ const newData = {
256
+ entityType: 'assortment',
257
+ publishToFlexPLM: true
258
+ };
259
+
260
+ const defaultIdentifiers = TypeDefaults.getDefaultIdentifierProperties(newData);
261
+ expect(defaultIdentifiers).toContain('flexPLMSeasonName');
262
+ expect(defaultIdentifiers).toHaveLength(1);
263
+ });
264
+
265
+ it('assortment - flex2vibeMapKeyRoot=LCSSeason', () =>{
266
+ const newData = {
267
+ entityType: 'assortment',
268
+ flex2vibeMapKeyRoot: 'LCSSeason'
269
+ };
270
+
271
+ const defaultIdentifiers = TypeDefaults.getDefaultIdentifierProperties(newData);
272
+ expect(defaultIdentifiers).toContain('flexPLMSeasonName');
273
+ expect(defaultIdentifiers).toHaveLength(1);
274
+ });
275
+
276
+ it('color', () =>{
277
+ const newData = {
278
+ entityType: 'color'
279
+ };
280
+
281
+ const defaultIdentifiers = TypeDefaults.getDefaultIdentifierProperties(newData);
282
+ expect(defaultIdentifiers).toContain('name');
283
+ expect(defaultIdentifiers).toHaveLength(1);
284
+ });
285
+
286
+ it('custom-entity', () =>{
287
+
288
+ const newData = {
289
+ entityType: 'custom-entity'
290
+ };
291
+
292
+ const defaultIdentifiers = TypeDefaults.getDefaultIdentifierProperties(newData);
293
+ expect(defaultIdentifiers).toContain('name');
294
+ expect(defaultIdentifiers).toHaveLength(1);
295
+ });
296
+ });
297
+
298
+ describe('getDefaultInformationalProperties', () =>{
299
+ it('item-family', () =>{
300
+ const newData = {
301
+ entityType: 'item',
302
+ roles: ['family']
303
+ };
304
+
305
+ const defaultIdentifiers = TypeDefaults.getDefaultInformationalProperties(newData);
306
+ expect(defaultIdentifiers).toContain('name');
307
+ expect(defaultIdentifiers).toHaveLength(1);
308
+ });
309
+
310
+ it('item-color', () =>{
311
+ const newData = {
312
+ entityType: 'item',
313
+ roles: ['color']
314
+ };
315
+
316
+ const defaultIdentifiers = TypeDefaults.getDefaultInformationalProperties(newData);
317
+ expect(defaultIdentifiers).toContain('optionName');
318
+ expect(defaultIdentifiers).toHaveLength(1);
319
+ });
320
+
321
+ it('project', () =>{
322
+ const newData = {
323
+ entityType: 'project'
324
+ };
325
+
326
+ const defaultIdentifiers = TypeDefaults.getDefaultInformationalProperties(newData);
327
+ expect(defaultIdentifiers).toContain('name');
328
+ expect(defaultIdentifiers).toHaveLength(1);
329
+ });
330
+
331
+ it('assortment', () =>{
332
+ const newData = {
333
+ entityType: 'assortment'
334
+ };
335
+
336
+ const defaultIdentifiers = TypeDefaults.getDefaultInformationalProperties(newData);
337
+ expect(defaultIdentifiers).toContain('name');
338
+ expect(defaultIdentifiers).toHaveLength(1);
339
+ });
340
+
341
+
342
+ it('color', () =>{
343
+ const newData = {
344
+ entityType: 'color'
345
+ };
346
+
347
+ const defaultIdentifiers = TypeDefaults.getDefaultInformationalProperties(newData);
348
+ expect(defaultIdentifiers).toHaveLength(0);
349
+ });
350
+
351
+ it('custom-entity', () =>{
352
+
353
+ const newData = {
354
+ entityType: 'custom-entity'
355
+ };
356
+
357
+ const defaultIdentifiers = TypeDefaults.getDefaultInformationalProperties(newData);
358
+ expect(defaultIdentifiers).toHaveLength(0);
359
+ });
360
+ });
361
+
362
+ describe('getEntityType', () =>{
363
+ it('entityType', () =>{
364
+ const entityType = 'item';
365
+ const entity = {
366
+ entityType
367
+ };
368
+
369
+ const results = TypeDefaults.getEntityType(entity);
370
+ expect(results).toEqual(entityType);
371
+ });
372
+
373
+ it('entityType from type path', () =>{
374
+ const entityType = 'item';
375
+ const typePath = 'item:product:apparel';
376
+ const entity = {
377
+ typePath: typePath
378
+ };
379
+
380
+ const results = TypeDefaults.getEntityType(entity);
381
+ expect(results).toEqual(entityType);
382
+ });
383
+
384
+ it('No entityType', () =>{
385
+ const typePath = 'item:product:apparel';
386
+ const entity = {
387
+ someValue: typePath
388
+ };
389
+
390
+ expect(() =>TypeDefaults.getEntityType(entity)).toThrowError();
391
+ expect(() =>TypeDefaults.getEntityType(entity)).toThrow(TypeDefaults.NO_ENTITY_TYPE);
392
+
393
+ });
394
+
395
+ });//getEntityType
396
+
397
+ describe('getDefaultEntityClass', () =>{
398
+ it('item - LCSProduct', () =>{
399
+ const object = {
400
+ flexPLMObjectClass: 'LCSProduct'
401
+ };
402
+
403
+ const entityClass = TypeDefaults.getDefaultEntityClass(object);
404
+
405
+ expect(entityClass).toBe('item');
406
+ });
407
+
408
+ it('item - LCSSKU', () =>{
409
+ const object = {
410
+ flexPLMObjectClass: 'LCSSKU'
411
+ };
412
+
413
+ const entityClass = TypeDefaults.getDefaultEntityClass(object);
414
+
415
+ expect(entityClass).toBe('item');
416
+ });
417
+
418
+ it('project-item - LCSProductSeasonLink', () =>{
419
+ const object = {
420
+ flexPLMObjectClass: 'LCSProductSeasonLink'
421
+ };
422
+
423
+ const entityClass = TypeDefaults.getDefaultEntityClass(object);
424
+
425
+ expect(entityClass).toBe('project-item');
426
+ });
427
+
428
+ it('project-item - LCSSKUSeasonLink', () =>{
429
+ const object = {
430
+ flexPLMObjectClass: 'LCSSKUSeasonLink'
431
+ };
432
+
433
+ const entityClass = TypeDefaults.getDefaultEntityClass(object);
434
+
435
+ expect(entityClass).toBe('project-item');
436
+ });
437
+
438
+ it('color - LCSColor', () =>{
439
+ const object = {
440
+ flexPLMObjectClass: 'LCSColor'
441
+ };
442
+
443
+ const entityClass = TypeDefaults.getDefaultEntityClass(object);
444
+
445
+ expect(entityClass).toBe('color');
446
+ });
447
+
448
+ it('assortment - LCSSeason', () =>{
449
+ const object = {
450
+ flexPLMObjectClass: 'LCSSeason'
451
+ };
452
+
453
+ const entityClass = TypeDefaults.getDefaultEntityClass(object);
454
+
455
+ expect(entityClass).toBe('assortment');
456
+ });
457
+
458
+ it('assortment - SeasonGroup', () =>{
459
+ const object = {
460
+ flexPLMObjectClass: 'SeasonGroup'
461
+ };
462
+
463
+ const entityClass = TypeDefaults.getDefaultEntityClass(object);
464
+
465
+ expect(entityClass).toBe('assortment');
466
+ });
467
+
468
+ it('custom-entity - LCSRevisableEntity', () =>{
469
+ const object = {
470
+ flexPLMObjectClass: 'LCSRevisableEntity'
471
+ };
472
+
473
+ const entityClass = TypeDefaults.getDefaultEntityClass(object);
474
+
475
+ expect(entityClass).toBe('custom-entity');
476
+ });
477
+
478
+ it('custom-entity - LCSLifecycleManaged', () =>{
479
+ const object = {
480
+ flexPLMObjectClass: 'LCSLifecycleManaged'
481
+ };
482
+
483
+ const entityClass = TypeDefaults.getDefaultEntityClass(object);
484
+
485
+ expect(entityClass).toBe('custom-entity');
486
+ });
487
+
488
+ it('item - LCSMaterial - processAsItem=true', () =>{
489
+ const object = {
490
+ flexPLMObjectClass: 'LCSMaterial'
491
+ };
492
+
493
+ TypeDefaults.applyConfig({ LCSMaterial: { processAsItem: true } });
494
+ try {
495
+ const entityClass = TypeDefaults.getDefaultEntityClass(object);
496
+ expect(entityClass).toBe('item');
497
+ } finally {
498
+ TypeDefaults.applyConfig({});
499
+ }
500
+ });
501
+
502
+ it('custom-entity - LCSMaterial - processAsItem=false (default)', () =>{
503
+ const object = {
504
+ flexPLMObjectClass: 'LCSMaterial'
505
+ };
506
+
507
+ const entityClass = TypeDefaults.getDefaultEntityClass(object);
508
+
509
+ expect(entityClass).toBe('custom-entity');
510
+ });
511
+
512
+ });//getDefaultEntityClass
513
+
514
+ describe('getDefaultEntityTypePath', () =>{
515
+ it('LCSProduct', () =>{
516
+ const object = {
517
+ flexPLMObjectClass: 'LCSProduct'
518
+ };
519
+
520
+ const typePath = TypeDefaults.getDefaultEntityTypePath(object);
521
+ expect(typePath).toBe('item');
522
+ });
523
+
524
+ it('LCSSKU', () =>{
525
+ const object = {
526
+ flexPLMObjectClass: 'LCSSKU'
527
+ };
528
+
529
+ const typePath = TypeDefaults.getDefaultEntityTypePath(object);
530
+ expect(typePath).toBe('item');
531
+ });
532
+ it('LCSProductSeasonLink', () =>{
533
+ const object = {
534
+ flexPLMObjectClass: 'LCSProductSeasonLink'
535
+ };
536
+
537
+ const typePath = TypeDefaults.getDefaultEntityTypePath(object);
538
+ expect(typePath).toBe('project-item');
539
+ });
540
+
541
+ it('LCSSKUSeasonLink', () =>{
542
+ const object = {
543
+ flexPLMObjectClass: 'LCSSKUSeasonLink'
544
+ };
545
+
546
+ const typePath = TypeDefaults.getDefaultEntityTypePath(object);
547
+ expect(typePath).toBe('project-item');
548
+ });
549
+
550
+ it('LCSColor', () =>{
551
+ const object = {
552
+ flexPLMObjectClass: 'LCSColor'
553
+ };
554
+
555
+ const typePath = TypeDefaults.getDefaultEntityTypePath(object);
556
+ expect(typePath).toBe('color');
557
+ });
558
+
559
+ it('LCSSeason', () =>{
560
+ const object = {
561
+ flexPLMObjectClass: 'LCSSeason'
562
+ };
563
+
564
+ const typePath = TypeDefaults.getDefaultEntityTypePath(object);
565
+ expect(typePath).toBe('assortment');
566
+ });
567
+
568
+ it('SeasonGroup', () =>{
569
+ const object = {
570
+ flexPLMObjectClass: 'SeasonGroup'
571
+ };
572
+
573
+ const typePath = TypeDefaults.getDefaultEntityTypePath(object);
574
+ expect(typePath).toBe('assortment');
575
+ });
576
+
577
+ it('LCSMaterial - processAsItem=true', () =>{
578
+ const object = {
579
+ flexPLMObjectClass: 'LCSMaterial'
580
+ };
581
+
582
+ TypeDefaults.applyConfig({ LCSMaterial: { processAsItem: true } });
583
+ try {
584
+ const typePath = TypeDefaults.getDefaultEntityTypePath(object);
585
+ expect(typePath).toBe('item:material');
586
+ } finally {
587
+ TypeDefaults.applyConfig({});
588
+ }
589
+ });
590
+
591
+ it('LCSMaterial - processAsItem=false (default) throws', () =>{
592
+ const object = {
593
+ flexPLMObjectClass: 'LCSMaterial'
594
+ };
595
+
596
+ expect(() => TypeDefaults.getDefaultEntityTypePath(object)).toThrowError(TypeDefaults.NO_TYPE_PATH);
597
+ });
598
+ });//getDefaultEntityTypePath
599
+
600
+ describe('getDefaultIdentifierPropertiesFromObject', () =>{
601
+ it('LCSProduct', () =>{
602
+ const object = {
603
+ flexPLMObjectClass: 'LCSProduct'
604
+ };
605
+ const defaultIdentifiers = TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
606
+
607
+ expect(defaultIdentifiers).toContain('itemNumber');
608
+ expect(defaultIdentifiers).toHaveLength(1);
609
+ });
610
+
611
+ it('LCSSKU', () =>{
612
+ const object = {
613
+ flexPLMObjectClass: 'LCSSKU'
614
+ };
615
+ const defaultIdentifiers = TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
616
+
617
+ expect(defaultIdentifiers).toContain('itemNumber');
618
+ expect(defaultIdentifiers).toHaveLength(1);
619
+ });
620
+
621
+ it('LCSSeason', () =>{
622
+ const object = {
623
+ flexPLMObjectClass: 'LCSSeason'
624
+ };
625
+ const defaultIdentifiers = TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
626
+
627
+ expect(defaultIdentifiers).toContain('flexPLMSeasonName');
628
+ expect(defaultIdentifiers).toHaveLength(1);
629
+ });
630
+
631
+ it('SeasonGroup', () =>{
632
+ const object = {
633
+ flexPLMObjectClass: 'SeasonGroup'
634
+ };
635
+ const defaultIdentifiers = TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
636
+
637
+ expect(defaultIdentifiers).toContain('seasonGroupName');
638
+ expect(defaultIdentifiers).toHaveLength(1);
639
+ });
640
+
641
+ it('LCSColor', () =>{
642
+ const object = {
643
+ flexPLMObjectClass: 'LCSColor'
644
+ };
645
+ const defaultIdentifiers = TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
646
+
647
+ expect(defaultIdentifiers).toContain('name');
648
+ expect(defaultIdentifiers).toHaveLength(1);
649
+ });
650
+
651
+ it('LCSRevisableEntity', () =>{
652
+ const object = {
653
+ flexPLMObjectClass: 'LCSRevisableEntity'
654
+ };
655
+ const defaultIdentifiers = TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
656
+
657
+ expect(defaultIdentifiers).toContain('name');
658
+ expect(defaultIdentifiers).toHaveLength(1);
659
+ });
660
+
661
+ it('LCSLifecycleManaged', () =>{
662
+ const object = {
663
+ flexPLMObjectClass: 'LCSLifecycleManaged'
664
+ };
665
+ const defaultIdentifiers = TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
666
+
667
+ expect(defaultIdentifiers).toContain('name');
668
+ expect(defaultIdentifiers).toHaveLength(1);
669
+ });
670
+
671
+ it('LCSMaterial - processAsItem=true', () =>{
672
+ const object = {
673
+ flexPLMObjectClass: 'LCSMaterial'
674
+ };
675
+ TypeDefaults.applyConfig({ LCSMaterial: { processAsItem: true } });
676
+ try {
677
+ const defaultIdentifiers = TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
678
+ expect(defaultIdentifiers).toContain('itemNumber');
679
+ expect(defaultIdentifiers).toHaveLength(1);
680
+ } finally {
681
+ TypeDefaults.applyConfig({});
682
+ }
683
+ });
684
+
685
+ it('LCSMaterial - processAsItem=false (default)', () =>{
686
+ const object = {
687
+ flexPLMObjectClass: 'LCSMaterial'
688
+ };
689
+ const defaultIdentifiers = TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
690
+
691
+ expect(defaultIdentifiers).toContain('name');
692
+ expect(defaultIdentifiers).toHaveLength(1);
693
+ });
694
+
695
+ });//getDefaultIdentifierPropertiesFromObject
696
+
697
+ describe('getDefaultInformationalPropertiesFromObject', () =>{
698
+ it('LCSProduct', () =>{
699
+ const object = {
700
+ flexPLMObjectClass: 'LCSProduct'
701
+ };
702
+
703
+ const defaultIdentifiers = TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
704
+ expect(defaultIdentifiers).toContain('name');
705
+ expect(defaultIdentifiers).toHaveLength(1);
706
+ });
707
+
708
+ it('LCSSKU', () =>{
709
+ const object = {
710
+ flexPLMObjectClass: 'LCSSKU'
711
+ };
712
+
713
+ const defaultIdentifiers = TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
714
+ expect(defaultIdentifiers).toContain('optionName');
715
+ expect(defaultIdentifiers).toHaveLength(1);
716
+ });
717
+
718
+ it('LCSSeason', () =>{
719
+ const object = {
720
+ flexPLMObjectClass: 'LCSSeason'
721
+ };
722
+
723
+ const defaultIdentifiers = TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
724
+ expect(defaultIdentifiers).toContain('name');
725
+ expect(defaultIdentifiers).toHaveLength(1);
726
+ });
727
+
728
+ it('SeasonGroup', () =>{
729
+ const object = {
730
+ flexPLMObjectClass: 'SeasonGroup'
731
+ };
732
+
733
+ const defaultIdentifiers = TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
734
+ expect(defaultIdentifiers).toContain('name');
735
+ expect(defaultIdentifiers).toHaveLength(1);
736
+ });
737
+
738
+ it('LCSMaterial - processAsItem=true', () =>{
739
+ const object = {
740
+ flexPLMObjectClass: 'LCSMaterial'
741
+ };
742
+
743
+ TypeDefaults.applyConfig({ LCSMaterial: { processAsItem: true } });
744
+ try {
745
+ const defaultIdentifiers = TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
746
+ expect(defaultIdentifiers).toContain('name');
747
+ expect(defaultIdentifiers).toHaveLength(1);
748
+ } finally {
749
+ TypeDefaults.applyConfig({});
750
+ }
751
+ });
752
+
753
+ it('LCSMaterial - processAsItem=false (default) yields no informational props', () =>{
754
+ const object = {
755
+ flexPLMObjectClass: 'LCSMaterial'
756
+ };
757
+
758
+ const defaultIdentifiers = TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
759
+ expect(defaultIdentifiers).toHaveLength(0);
760
+ });
761
+
762
+ });//getDefaultInformationalPropertiesFromObject
763
+
764
+ describe('applyConfig', () => {
765
+ afterEach(() => {
766
+ TypeDefaults.applyConfig({});
767
+ });
768
+
769
+ it('sets processLCSMaterialAsItem=true when processAsItem=true', () => {
770
+ TypeDefaults.applyConfig({ LCSMaterial: { processAsItem: true } });
771
+ expect(TypeDefaults.processLCSMaterialAsItem).toBe(true);
772
+ });
773
+
774
+ it('sets processLCSMaterialAsItem=true when processAsItem=\"true\" (string)', () => {
775
+ TypeDefaults.applyConfig({ LCSMaterial: { processAsItem: 'true' } });
776
+ expect(TypeDefaults.processLCSMaterialAsItem).toBe(true);
777
+ });
778
+
779
+ it('sets processLCSMaterialAsItem=false when processAsItem=false', () => {
780
+ TypeDefaults.processLCSMaterialAsItem = true;
781
+ TypeDefaults.applyConfig({ LCSMaterial: { processAsItem: false } });
782
+ expect(TypeDefaults.processLCSMaterialAsItem).toBe(false);
783
+ });
784
+
785
+ it('sets processLCSMaterialAsItem=false when LCSMaterial missing', () => {
786
+ TypeDefaults.processLCSMaterialAsItem = true;
787
+ TypeDefaults.applyConfig({});
788
+ expect(TypeDefaults.processLCSMaterialAsItem).toBe(false);
789
+ });
790
+
791
+ it('sets processLCSMaterialAsItem=false when config is null/undefined', () => {
792
+ TypeDefaults.processLCSMaterialAsItem = true;
793
+ TypeDefaults.applyConfig(undefined);
794
+ expect(TypeDefaults.processLCSMaterialAsItem).toBe(false);
795
+ });
796
+ });
797
+ });