@contrail/flexplm 1.3.0 → 1.3.1-alpha.56221f6
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/lib/cli/commands/compile.d.ts +1 -0
- package/lib/cli/commands/compile.js +71 -0
- package/lib/cli/commands/compile.spec.d.ts +1 -0
- package/lib/cli/commands/compile.spec.js +80 -0
- package/lib/cli/commands/create.d.ts +1 -0
- package/lib/cli/commands/create.js +75 -0
- package/lib/cli/commands/create.spec.d.ts +1 -0
- package/lib/cli/commands/create.spec.js +78 -0
- package/lib/cli/commands/upload.d.ts +10 -0
- package/lib/cli/commands/upload.js +219 -0
- package/lib/cli/commands/upload.spec.d.ts +1 -0
- package/lib/cli/commands/upload.spec.js +88 -0
- package/lib/cli/index.d.ts +2 -0
- package/lib/cli/index.js +64 -0
- package/lib/cli/index.spec.d.ts +1 -0
- package/lib/cli/index.spec.js +79 -0
- package/lib/cli/template/mapping-template.ts.template +18 -0
- package/lib/entity-processor/base-entity-processor.d.ts +89 -42
- package/lib/entity-processor/base-entity-processor.js +438 -385
- package/lib/entity-processor/base-entity-processor.spec.d.ts +1 -1
- package/lib/entity-processor/base-entity-processor.spec.js +398 -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 +23 -22
- package/lib/index.js +39 -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/mapping-file.d.ts +429 -0
- package/lib/interfaces/mapping-file.js +2 -0
- 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 +118 -93
- package/lib/publish/base-process-publish-assortment.js +998 -944
- package/lib/publish/base-process-publish-assortment.spec.d.ts +1 -1
- package/lib/publish/base-process-publish-assortment.spec.js +1688 -1670
- package/lib/publish/mockData.d.ts +1389 -1389
- package/lib/publish/mockData.js +4524 -4519
- package/lib/transform/identifier-conversion-spec-mockData.js +472 -444
- package/lib/transform/identifier-conversion.d.ts +51 -15
- package/lib/transform/identifier-conversion.js +248 -212
- package/lib/transform/identifier-conversion.spec.d.ts +1 -1
- package/lib/transform/identifier-conversion.spec.js +343 -339
- package/lib/util/config-defaults.d.ts +8 -8
- package/lib/util/config-defaults.js +88 -85
- package/lib/util/config-defaults.spec.d.ts +1 -1
- package/lib/util/config-defaults.spec.js +302 -293
- package/lib/util/data-converter-spec-mockData.js +219 -205
- package/lib/util/data-converter.d.ts +136 -39
- package/lib/util/data-converter.js +718 -592
- package/lib/util/data-converter.spec.d.ts +1 -1
- package/lib/util/data-converter.spec.js +906 -904
- package/lib/util/error-response-object.d.ts +9 -4
- package/lib/util/error-response-object.js +54 -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 +24 -23
- package/lib/util/federation.d.ts +15 -15
- package/lib/util/federation.js +157 -149
- package/lib/util/flexplm-connect.d.ts +29 -22
- package/lib/util/flexplm-connect.js +190 -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 +27 -26
- package/lib/util/map-util-spec-mockData.js +219 -205
- package/lib/util/map-utils.d.ts +33 -6
- package/lib/util/map-utils.js +42 -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 +55 -34
- package/lib/util/thumbnail-util.js +242 -215
- package/lib/util/thumbnail-util.spec.d.ts +1 -1
- package/lib/util/thumbnail-util.spec.js +440 -434
- package/lib/util/type-conversion-utils-spec-mockData.js +259 -259
- package/lib/util/type-conversion-utils.d.ts +163 -23
- package/lib/util/type-conversion-utils.js +408 -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 +74 -16
- package/lib/util/type-defaults.js +279 -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 +34 -13
- package/lib/util/type-utils.js +137 -114
- package/lib/util/type-utils.spec.d.ts +1 -1
- package/lib/util/type-utils.spec.js +192 -190
- package/package.json +21 -6
- package/scripts/copy-template.js +10 -0
- package/.claude/settings.local.json +0 -8
- package/.github/pull_request_template.md +0 -31
- package/.github/workflows/flexplm-lib.yml +0 -27
- package/.github/workflows/publish-to-npm.yml +0 -124
- package/CHANGELOG.md +0 -32
- package/publish.bat +0 -5
- package/publish.sh +0 -5
- package/src/entity-processor/base-entity-processor.spec.ts +0 -460
- package/src/entity-processor/base-entity-processor.ts +0 -515
- package/src/flexplm-request.ts +0 -28
- package/src/flexplm-utils.spec.ts +0 -27
- package/src/flexplm-utils.ts +0 -29
- package/src/index.ts +0 -22
- package/src/interfaces/interfaces.ts +0 -122
- package/src/interfaces/item-family-changes.ts +0 -67
- package/src/interfaces/publish-change-data.ts +0 -43
- package/src/publish/base-process-publish-assortment-callback.ts +0 -50
- package/src/publish/base-process-publish-assortment.spec.ts +0 -1992
- package/src/publish/base-process-publish-assortment.ts +0 -1134
- package/src/publish/mockData.ts +0 -4561
- package/src/transform/identifier-conversion-spec-mockData.ts +0 -496
- package/src/transform/identifier-conversion.spec.ts +0 -354
- package/src/transform/identifier-conversion.ts +0 -282
- package/src/util/config-defaults.spec.ts +0 -350
- package/src/util/config-defaults.ts +0 -93
- package/src/util/data-converter-spec-mockData.ts +0 -231
- package/src/util/data-converter.spec.ts +0 -1041
- package/src/util/data-converter.ts +0 -762
- package/src/util/error-response-object.spec.ts +0 -116
- package/src/util/error-response-object.ts +0 -50
- package/src/util/event-short-message-status.ts +0 -22
- package/src/util/federation.ts +0 -172
- package/src/util/flexplm-connect.spec.ts +0 -132
- package/src/util/flexplm-connect.ts +0 -208
- package/src/util/logger-config.ts +0 -20
- package/src/util/map-util-spec-mockData.ts +0 -231
- package/src/util/map-utils.spec.ts +0 -103
- package/src/util/map-utils.ts +0 -41
- package/src/util/mockData.ts +0 -101
- package/src/util/thumbnail-util.spec.ts +0 -508
- package/src/util/thumbnail-util.ts +0 -272
- package/src/util/type-conversion-utils-spec-mockData.ts +0 -271
- package/src/util/type-conversion-utils.spec.ts +0 -968
- package/src/util/type-conversion-utils.ts +0 -460
- package/src/util/type-defaults.spec.ts +0 -669
- package/src/util/type-defaults.ts +0 -281
- package/src/util/type-utils.spec.ts +0 -227
- package/src/util/type-utils.ts +0 -144
- package/tsconfig.json +0 -29
- package/tslint.json +0 -57
|
@@ -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
|
+
}); //getEntityType
|
|
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
|
+
}); //getDefaultEntityClass
|
|
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
|
+
}); //getDefaultEntityTypePath
|
|
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
|
+
}); //getDefaultIdentifierPropertiesFromObject
|
|
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
|
+
}); //getDefaultInformationalPropertiesFromObject
|
|
516
|
+
});
|