@contrail/flexplm 1.3.2-alpha.833d673 → 1.3.2-alpha.8e1fd24

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.
@@ -110,6 +110,9 @@ class DataConverter {
110
110
  else if ('userList' === propertyType) {
111
111
  value = await this.getUserListValue(prop, newData);
112
112
  }
113
+ else if ('size_range' === propertyType) {
114
+ value = nd;
115
+ }
113
116
  return value;
114
117
  }
115
118
  getEnumerationValue(prop, nd) {
@@ -292,7 +295,7 @@ class DataConverter {
292
295
  value = await this.setUserListValue(prop, nd);
293
296
  }
294
297
  else if ('size_range' === propertyType) {
295
- value = nd || {};
298
+ value = nd;
296
299
  }
297
300
  return value;
298
301
  }
@@ -902,3 +902,69 @@ describe('getUserListValue', () => {
902
902
  expect(returnValue.lastName).toEqual('Smith');
903
903
  });
904
904
  });
905
+ describe('getFlexPLMValue size_range', () => {
906
+ const config = {
907
+ apiHost: 'host',
908
+ userName: () => 'user',
909
+ password: () => 'pass',
910
+ urlContext: 'xxx',
911
+ vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
912
+ csrfEndpoint: '/servlet/rest/security/csrf',
913
+ itemPreDevelopmentLifecycleStages: ['concept']
914
+ };
915
+ const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
916
+ const dc = new data_converter_1.DataConverter(config, mapFileUtil);
917
+ const sizeRangeProp = {
918
+ propertyType: 'size_range',
919
+ slug: 'sizeRange',
920
+ label: 'Size Range',
921
+ };
922
+ it('returns sizeRange object when value is present', async () => {
923
+ const newData = { sizeRange: { sizes: ['PRE', 'NB'] } };
924
+ const returnValue = await dc.getFlexPLMValue(sizeRangeProp, newData, true);
925
+ expect(returnValue).toEqual({ sizes: ['PRE', 'NB'] });
926
+ });
927
+ it('returns null when sizeRange is null', async () => {
928
+ const newData = { sizeRange: null };
929
+ const returnValue = await dc.getFlexPLMValue(sizeRangeProp, newData, true);
930
+ expect(returnValue).toBeNull();
931
+ });
932
+ it('returns undefined when sizeRange is missing', async () => {
933
+ const newData = {};
934
+ const returnValue = await dc.getFlexPLMValue(sizeRangeProp, newData, true);
935
+ expect(returnValue).toBeUndefined();
936
+ });
937
+ });
938
+ describe('getEntityValue size_range', () => {
939
+ const config = {
940
+ apiHost: 'host',
941
+ userName: () => 'user',
942
+ password: () => 'pass',
943
+ urlContext: 'xxx',
944
+ vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
945
+ csrfEndpoint: '/servlet/rest/security/csrf',
946
+ itemPreDevelopmentLifecycleStages: ['concept']
947
+ };
948
+ const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
949
+ const dc = new data_converter_1.DataConverter(config, mapFileUtil);
950
+ const sizeRangeProp = {
951
+ propertyType: 'size_range',
952
+ slug: 'sizeRange',
953
+ label: 'Size Range',
954
+ };
955
+ it('returns sizeRange object when value is present', async () => {
956
+ const data = { sizeRange: { sizes: ['PRE', 'NB'] } };
957
+ const returnValue = await dc.getEntityValue(sizeRangeProp, data);
958
+ expect(returnValue).toEqual({ sizes: ['PRE', 'NB'] });
959
+ });
960
+ it('returns null when sizeRange is null', async () => {
961
+ const data = { sizeRange: null };
962
+ const returnValue = await dc.getEntityValue(sizeRangeProp, data);
963
+ expect(returnValue).toBeNull();
964
+ });
965
+ it('returns undefined when sizeRange is missing', async () => {
966
+ const data = {};
967
+ const returnValue = await dc.getEntityValue(sizeRangeProp, data);
968
+ expect(returnValue).toBeUndefined();
969
+ });
970
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/flexplm",
3
- "version": "1.3.2-alpha.833d673",
3
+ "version": "1.3.2-alpha.8e1fd24",
4
4
  "description": "Library used for integration with flexplm.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1038,4 +1038,83 @@ describe('getUserListValue', () =>{
1038
1038
  expect(returnValue.lastName).toEqual('Smith');
1039
1039
  });
1040
1040
 
1041
+ });
1042
+
1043
+
1044
+ describe('getFlexPLMValue size_range', () => {
1045
+ const config: FCConfig = {
1046
+ apiHost: 'host',
1047
+ userName: () => 'user',
1048
+ password: () => 'pass',
1049
+ urlContext: 'xxx',
1050
+ vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
1051
+ csrfEndpoint: '/servlet/rest/security/csrf',
1052
+ itemPreDevelopmentLifecycleStages: ['concept']
1053
+ };
1054
+
1055
+ const mapFileUtil = new MapFileUtil(new Entities());
1056
+ const dc = new DataConverter(config, mapFileUtil);
1057
+
1058
+ const sizeRangeProp = {
1059
+ propertyType: 'size_range',
1060
+ slug: 'sizeRange',
1061
+ label: 'Size Range',
1062
+ };
1063
+
1064
+ it('returns sizeRange object when value is present', async () => {
1065
+ const newData = { sizeRange: { sizes: ['PRE', 'NB'] } };
1066
+ const returnValue = await dc.getFlexPLMValue(sizeRangeProp, newData, true);
1067
+ expect(returnValue).toEqual({ sizes: ['PRE', 'NB'] });
1068
+ });
1069
+
1070
+ it('returns null when sizeRange is null', async () => {
1071
+ const newData = { sizeRange: null };
1072
+ const returnValue = await dc.getFlexPLMValue(sizeRangeProp, newData, true);
1073
+ expect(returnValue).toBeNull();
1074
+ });
1075
+
1076
+ it('returns undefined when sizeRange is missing', async () => {
1077
+ const newData = {};
1078
+ const returnValue = await dc.getFlexPLMValue(sizeRangeProp, newData, true);
1079
+ expect(returnValue).toBeUndefined();
1080
+ });
1081
+ });
1082
+
1083
+ describe('getEntityValue size_range', () => {
1084
+ const config: FCConfig = {
1085
+ apiHost: 'host',
1086
+ userName: () => 'user',
1087
+ password: () => 'pass',
1088
+ urlContext: 'xxx',
1089
+ vibeEventEndpoint: '/rfa/vibeiq/vibeEvents',
1090
+ csrfEndpoint: '/servlet/rest/security/csrf',
1091
+ itemPreDevelopmentLifecycleStages: ['concept']
1092
+ };
1093
+
1094
+ const mapFileUtil = new MapFileUtil(new Entities());
1095
+ const dc = new DataConverter(config, mapFileUtil);
1096
+
1097
+ const sizeRangeProp = {
1098
+ propertyType: 'size_range',
1099
+ slug: 'sizeRange',
1100
+ label: 'Size Range',
1101
+ };
1102
+
1103
+ it('returns sizeRange object when value is present', async () => {
1104
+ const data = { sizeRange: { sizes: ['PRE', 'NB'] } };
1105
+ const returnValue = await dc.getEntityValue(sizeRangeProp, data);
1106
+ expect(returnValue).toEqual({ sizes: ['PRE', 'NB'] });
1107
+ });
1108
+
1109
+ it('returns null when sizeRange is null', async () => {
1110
+ const data = { sizeRange: null };
1111
+ const returnValue = await dc.getEntityValue(sizeRangeProp, data);
1112
+ expect(returnValue).toBeNull();
1113
+ });
1114
+
1115
+ it('returns undefined when sizeRange is missing', async () => {
1116
+ const data = {};
1117
+ const returnValue = await dc.getEntityValue(sizeRangeProp, data);
1118
+ expect(returnValue).toBeUndefined();
1119
+ });
1041
1120
  });
@@ -119,6 +119,8 @@ export class DataConverter {
119
119
  value = nd;
120
120
  } else if ('userList' === propertyType) {
121
121
  value = await this.getUserListValue(prop, newData);
122
+ }else if ('size_range' === propertyType){
123
+ value = nd;
122
124
  }
123
125
 
124
126
  return value;
@@ -354,7 +356,7 @@ export class DataConverter {
354
356
  } else if ('userList' === propertyType) {
355
357
  value = await this.setUserListValue(prop, nd);
356
358
  }else if ('size_range' === propertyType){
357
- value = nd || {};
359
+ value = nd;
358
360
  }
359
361
 
360
362
  // console.log(value);