@getjones/test-infra 2.7.13 → 2.7.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getjones/test-infra",
3
- "version": "2.7.13",
3
+ "version": "2.7.14",
4
4
  "description": "Providing internal and openapi interface",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -25,7 +25,7 @@ const getOverrideGapModel = (
25
25
  record,
26
26
  policyName,
27
27
  attributeName,
28
- waiverReason,
28
+ reason,
29
29
  remarks,
30
30
  {
31
31
  userId,
@@ -35,19 +35,19 @@ const getOverrideGapModel = (
35
35
  userId = userId || env.getSystemUserIdentity(credentials.superUser).id;
36
36
  userRole = userRole || userTypes.ICS;
37
37
 
38
- const waiveModel = new OverrideGapModel({
38
+ const overrideGapModel = new OverrideGapModel({
39
39
  contractorId: record.id,
40
40
  auditId,
41
- waiverReason,
41
+ reason,
42
42
  remarks,
43
43
  userId,
44
44
  userRole
45
45
  });
46
46
 
47
- return waiveModel;
47
+ return overrideGapModel;
48
48
  };
49
49
 
50
- const getWaiveModelByGap = (
50
+ const getOverrideGapModelByGap = (
51
51
  record,
52
52
  policyName,
53
53
  gap,
@@ -96,14 +96,14 @@ const getPolicyAuditIdFromRecord = (record, policyName, attributeName) => {
96
96
 
97
97
  // PRIVATE METHOD - please refer to waiveAllGaps / acceptAllGaps according to your needs
98
98
  const overrideAllGaps = async (record, context, { reason = OVERRIDE_GAP_REASONS.BUSINESS_DECISION, note = 'WAIVED AUTOMATICALLY' } = {}) => {
99
- const allWaivablePolicies = auditUtil.getAllWaivablePolicies(record, context);
99
+ const allOverriddenPolicies = auditUtil.getAllOverriddenGapPolicies(record, context);
100
100
 
101
- for (const waivable of allWaivablePolicies) {
102
- const overrideGapModel = getOverrideGapModel(record, waivable.policyName, waivable.attributeName, reason, note);
103
- const waiveResponse = await overrideGap({ overrideGapModel, context });
101
+ for (const policy of allOverriddenPolicies) {
102
+ const overrideGapModel = getOverrideGapModel(record, policy.policyName, policy.attributeName, reason, note);
103
+ const overrideGapResponse = await overrideGap({ overrideGapModel, context });
104
104
 
105
- if (waiveResponse.status !== httpResponseStatusCodes.OK) {
106
- throw Error(`Failed to waive ${waivable.policyName} - ${waivable.attributeName} for ${record.company}`);
105
+ if (overrideGapResponse.status !== httpResponseStatusCodes.OK) {
106
+ throw Error(`Failed to override gap ${policy.policyName} - ${policy.attributeName} for ${record.company}`);
107
107
  }
108
108
  }
109
109
  };
@@ -127,7 +127,7 @@ module.exports = {
127
127
  waiveAllGaps,
128
128
  getOverrideGapModel,
129
129
  getRetractModel,
130
- getWaiveModelByGap,
130
+ getOverrideGapModelByGap,
131
131
  overrideGap,
132
132
  retractOverride
133
133
  };
@@ -1,10 +1,10 @@
1
1
  class OverrideGapModel {
2
2
  constructor({
3
- contractorId, auditId, waiverReason, remarks, userId, userRole
3
+ contractorId, auditId, reason, remarks, userId, userRole
4
4
  }) {
5
5
  this.auditorContractorId = auditId;
6
6
  this.contractorId = contractorId;
7
- this.waiverReason = waiverReason;
7
+ this.reason = reason;
8
8
  this.remarks = remarks || '';
9
9
  this.userId = userId;
10
10
  this.userRole = userRole;
@@ -22,10 +22,6 @@ const getAttributeKey = attribute => {
22
22
  return specialAttributes[attribute] || attribute;
23
23
  };
24
24
 
25
- const getWaiveReason = reason => {
26
- return waiveReasons[reason] || reason;
27
- };
28
-
29
25
  const getAttributeNameByGap = function(record, policyName, gap) {
30
26
  const policy = record.reviewbyAuditor.find(contractorCoverage =>
31
27
  contractorCoverage.insuranceName === policyName);
@@ -43,8 +39,8 @@ const getAttributeNameByGap = function(record, policyName, gap) {
43
39
  return attribute.limitname;
44
40
  };
45
41
 
46
- const getAllWaivablePolicies = function(record) {
47
- const waivable = [];
42
+ const getAllOverriddenGapPolicies = function(record) {
43
+ const overridden = [];
48
44
 
49
45
  const policies = record.reviewbyAuditor;
50
46
  for (const policy of policies) {
@@ -55,7 +51,7 @@ const getAllWaivablePolicies = function(record) {
55
51
 
56
52
  for (const error of errorList) {
57
53
  if (error.warningStatus === 'POLICYERROR' && error.errorStatus === 'notIgnored') {
58
- waivable.push({
54
+ overridden.push({
59
55
  policyName: policyName,
60
56
  attributeName: error.limitname
61
57
  });
@@ -63,7 +59,7 @@ const getAllWaivablePolicies = function(record) {
63
59
  }
64
60
  }
65
61
 
66
- return waivable;
62
+ return overridden;
67
63
  };
68
64
 
69
65
  const getPolicyId = (policyName, requirement) => {
@@ -176,8 +172,7 @@ module.exports = {
176
172
  createAuditEntity,
177
173
  getAttributeKey,
178
174
  getAttributeNameByGap,
179
- getWaiveReason,
180
- getAllWaivablePolicies
175
+ getAllOverriddenGapPolicies
181
176
  };
182
177
 
183
178
  const certificateEndorsmentsList = [
@@ -214,9 +209,3 @@ const specialAttributes = {
214
209
  'Umbrella': 'UMoccur'
215
210
  }
216
211
  };
217
-
218
- const waiveReasons = {
219
- 'No Exposure': OVERRIDE_GAP_REASONS.NO_EXPOSURE,
220
- 'Business Decision': OVERRIDE_GAP_REASONS.BUSINESS_DECISION,
221
- 'Executive Approval': OVERRIDE_GAP_REASONS.EXECUTIVE_APPROVAL
222
- };