stand_socotra_policy_transformer 3.0.11 → 3.0.13

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 (71) hide show
  1. package/dist/stand_underwriter.js +1 -1
  2. package/package.json +8 -2
  3. package/__tests__/__utils__/load_payload.js +0 -16
  4. package/__tests__/__utils__/payloads/ai_additional_insured_new.json +0 -90
  5. package/__tests__/__utils__/payloads/ai_no_change_new_payload.json +0 -103
  6. package/__tests__/__utils__/payloads/ai_no_change_old_payload.json +0 -764
  7. package/__tests__/__utils__/payloads/ai_old_payload.json +0 -707
  8. package/__tests__/__utils__/payloads/claims_new_policy.json +0 -117
  9. package/__tests__/__utils__/payloads/claims_remove_new_payload.json +0 -68
  10. package/__tests__/__utils__/payloads/claims_remove_socotra_policy.json +0 -785
  11. package/__tests__/__utils__/payloads/claims_socotra_payload.json +0 -764
  12. package/__tests__/__utils__/payloads/minimal_change_base.json +0 -574
  13. package/__tests__/__utils__/payloads/minimal_change_base2.json +0 -574
  14. package/__tests__/__utils__/payloads/minimal_change_resulting_socotra.json +0 -17
  15. package/__tests__/__utils__/payloads/minimal_change_resulting_socotra2.json +0 -27
  16. package/__tests__/__utils__/payloads/minimal_change_retool.json +0 -37
  17. package/__tests__/__utils__/payloads/minimal_change_retool2.json +0 -27
  18. package/__tests__/__utils__/payloads/sample_minimal_retool.json +0 -33
  19. package/__tests__/__utils__/payloads/sample_minimal_socotra_payload.json +0 -116
  20. package/__tests__/__utils__/payloads/sample_new_policy_holder.json +0 -17
  21. package/__tests__/__utils__/payloads/sample_new_quote.json +0 -216
  22. package/__tests__/__utils__/payloads/sample_new_quote_retool.json +0 -93
  23. package/__tests__/__utils__/payloads/sample_retool.json +0 -157
  24. package/__tests__/__utils__/payloads/sample_retool_converted_quote.json +0 -54
  25. package/__tests__/__utils__/payloads/sample_retool_socotra_subset.json +0 -163
  26. package/__tests__/__utils__/payloads/sample_socotra_quote.json +0 -782
  27. package/__tests__/__utils__/payloads/sample_socotra_with_additional_insured.json +0 -764
  28. package/__tests__/__utils__/payloads/sample_update_quote.json +0 -18
  29. package/__tests__/__utils__/payloads/versions/v1/sample_new_quote.json +0 -211
  30. package/__tests__/__utils__/payloads/versions/v1/sample_retool.json +0 -160
  31. package/__tests__/__utils__/payloads/versions/v1/sample_retool_socotra_subset.json +0 -128
  32. package/__tests__/__utils__/payloads/versions/v1/sample_socotra_quote.json +0 -776
  33. package/__tests__/__utils__/payloads/versions/v1/sample_update_quote.json +0 -18
  34. package/__tests__/__utils__/payloads/versions/v2/sample_new_quote.json +0 -215
  35. package/__tests__/__utils__/payloads/versions/v2/sample_retool.json +0 -165
  36. package/__tests__/__utils__/payloads/versions/v2/sample_retool_socotra_subset.json +0 -159
  37. package/__tests__/__utils__/payloads/versions/v2/sample_socotra_quote.json +0 -779
  38. package/__tests__/__utils__/payloads/versions/v2/sample_update_quote.json +0 -18
  39. package/__tests__/basic_knockout.test.js +0 -113
  40. package/__tests__/claims_history_knockout.test.js +0 -56
  41. package/__tests__/exterior_knockout.test.js +0 -192
  42. package/__tests__/helpers/index.js +0 -10
  43. package/__tests__/home_owner_knockouts.js +0 -260
  44. package/__tests__/interior_knockout.test.js +0 -321
  45. package/__tests__/package_version.test.js +0 -7
  46. package/__tests__/rate_call_knockouts.test.js +0 -347
  47. package/__tests__/retool_utils/socotra_group_update.test.js +0 -563
  48. package/__tests__/retool_utils/socotra_payload.test.js +0 -270
  49. package/__tests__/retool_utils/socotra_structure_helper.test.js +0 -242
  50. package/__tests__/retool_utils/versions/entries_v1.test.js +0 -51
  51. package/__tests__/retool_utils/versions/entries_v2.test.js +0 -51
  52. package/__tests__/underwriter.test.js +0 -169
  53. package/__tests__/wf_knockout.test.js +0 -124
  54. package/src/index.js +0 -14
  55. package/src/knockouts/basic_knockouts.js +0 -66
  56. package/src/knockouts/claims_history_knockout.js +0 -24
  57. package/src/knockouts/exterior_knockouts.js +0 -97
  58. package/src/knockouts/home_owner_knockouts.js +0 -118
  59. package/src/knockouts/index.js +0 -83
  60. package/src/knockouts/interior_knockouts.js +0 -149
  61. package/src/knockouts/rate_call_knockouts.js +0 -155
  62. package/src/knockouts/wf_knockouts.js +0 -66
  63. package/src/retool_to_socotra.js +0 -18
  64. package/src/retool_utils/socotra_entries_helper_fuctions.js +0 -0
  65. package/src/retool_utils/socotra_payloads.js +0 -161
  66. package/src/retool_utils/socotra_structure_helper.js +0 -687
  67. package/src/retool_utils/versions/stand_v1_entries.js +0 -167
  68. package/src/retool_utils/versions/stand_v2_entries.js +0 -211
  69. package/src/retool_utils/versions/stand_v3_entries.js +0 -274
  70. package/src/underwriter.js +0 -86
  71. package/webpack.config.js +0 -14
@@ -1,563 +0,0 @@
1
- const { SocotraEntry, SocotraGroupEntry } = require("../../src/retool_utils/socotra_structure_helper");
2
- const { load_payload } = require("../__utils__/load_payload");
3
-
4
- describe("socotraGroupEntry update operations", () => {
5
- // Define schemas at the test suite level
6
- let socotra_schema;
7
- let retool_schema;
8
- let sge;
9
-
10
- beforeEach(() => {
11
- // Initialize fresh instances before each test to prevent cross-contamination
12
- socotra_schema = {
13
- type: ":type",
14
- name: ":name",
15
- street_address: ":street_address",
16
- street_address2: ":street_address2",
17
- city: ":city",
18
- state: ":state",
19
- zip: ":zip",
20
- description: ":description",
21
- loan_number: ":loan_number"
22
- };
23
-
24
- retool_schema = {
25
- zip: ":zip",
26
- street_address: ":street_address",
27
- loan_number: ":loan_number",
28
- city: ":city",
29
- street_address2: ":street_address2",
30
- state: ":state",
31
- type: ":type"
32
- };
33
-
34
- sge = new SocotraGroupEntry("additional_insured_data.additionalInterest", "additional_insured", "policy.fields.group", socotra_schema, retool_schema);
35
- });
36
-
37
- test('Add field groups - should add new field groups to the template', () => {
38
- // Create an update template
39
- let template = SocotraEntry.socotra_create_update_template("exposure_locator");
40
-
41
- // Create a payload with addFieldGroups
42
- let retool_payload = {
43
- additional_insured_data: {
44
- "additionalInterest": [
45
- {
46
- "zip": "94104",
47
- "street_address": "548 Market Street",
48
- "loan_number": "1231312",
49
- "city": "San Francisco",
50
- "street_address2": "PMB 70879",
51
- "state": "California",
52
- "type": "Mortgagee"
53
- }
54
- ]
55
- }
56
- };
57
-
58
- // Call the method to test
59
- sge.socotra_update(retool_payload, template);
60
-
61
- // Verify that addFieldGroups is populated correctly
62
- expect(template.addFieldGroups).toBeDefined();
63
- expect(template.addFieldGroups.length).toBe(1);
64
- expect(template.addFieldGroups[0]).toEqual({
65
- fieldName: "additional_insured",
66
- fieldValues: {
67
- type: "Mortgagee",
68
- street_address: "548 Market Street",
69
- street_address2: "PMB 70879",
70
- city: "San Francisco",
71
- state: "California",
72
- zip: "94104",
73
- loan_number: "1231312"
74
- }
75
- });
76
- });
77
-
78
-
79
- test('Remove field groups - should remove field groups from the template', () => {
80
- // Create an update template
81
- let template = SocotraEntry.socotra_create_update_template("exposure_locator");
82
-
83
- // Create a payload with removeFieldGroups
84
- let retool_payload = {
85
- additional_insured_data: {
86
- "additionalInterest": [
87
- {
88
- "locator": "fg-123",
89
- "remove": true
90
- },
91
- {
92
- "locator": "fg-456",
93
- "remove": true
94
- }
95
- ]
96
- }
97
- };
98
-
99
- // Call the method to test
100
- sge.socotra_update(retool_payload, template);
101
-
102
- // Verify that removeFieldGroups is populated correctly
103
- expect(template.removeFieldGroups).toBeDefined();
104
- expect(template.removeFieldGroups.length).toBe(2);
105
- expect(template.removeFieldGroups).toContain("fg-123");
106
- expect(template.removeFieldGroups).toContain("fg-456");
107
- });
108
-
109
- test('Mixed operations - should handle add and remove operations in the same payload', () => {
110
- // Create an update template
111
- let template = SocotraEntry.socotra_create_update_template("exposure_locator");
112
-
113
- // Create a payload with add and remove operations
114
- let retool_payload = {
115
- additional_insured_data: {
116
- "additionalInterest": [
117
- // Add new field group
118
- {
119
- "zip": "94104",
120
- "street_address": "New Address",
121
- "loan_number": "1231312",
122
- "city": "San Francisco",
123
- "street_address2": "PMB 70879",
124
- "state": "California",
125
- "type": "Mortgagee"
126
- },
127
- // Remove field group
128
- {
129
- "locator": "fg-456",
130
- "remove": true
131
- }
132
- ]
133
- }
134
- };
135
-
136
- // Call the method to test
137
- sge.socotra_update(retool_payload, template);
138
-
139
- // Verify that all operations are populated correctly
140
-
141
- // Check addFieldGroups
142
- expect(template.addFieldGroups).toBeDefined();
143
- expect(template.addFieldGroups.length).toBe(1);
144
- expect(template.addFieldGroups[0]).toEqual({
145
- fieldName: "additional_insured",
146
- fieldValues: {
147
- type: "Mortgagee",
148
- street_address: "New Address",
149
- street_address2: "PMB 70879",
150
- city: "San Francisco",
151
- state: "California",
152
- zip: "94104",
153
- loan_number: "1231312"
154
- }
155
- });
156
-
157
- // Check removeFieldGroups
158
- expect(template.removeFieldGroups).toBeDefined();
159
- expect(template.removeFieldGroups.length).toBe(1);
160
- expect(template.removeFieldGroups).toContain("fg-456");
161
- });
162
-
163
- test('Empty array - should not add any operations to the template', () => {
164
- // Create an update template
165
- let template = SocotraEntry.socotra_create_update_template("exposure_locator");
166
-
167
- // Create a payload with an empty array
168
- let retool_payload = {
169
- additional_insured_data: {
170
- "additionalInterest": []
171
- }
172
- };
173
-
174
- // Call the method to test
175
- sge.socotra_update(retool_payload, template);
176
-
177
- // Verify that no operations are added to the template
178
- expect(template.addFieldGroups).toBeUndefined();
179
- expect(template.removeFieldGroups).toBeUndefined();
180
- });
181
-
182
- test('Missing fields - should handle items with missing fields', () => {
183
- // Create an update template
184
- let template = SocotraEntry.socotra_create_update_template("exposure_locator");
185
-
186
- // Create a payload with missing fields
187
- let retool_payload = {
188
- additional_insured_data: {
189
- "additionalInterest": [
190
- // Add new field group with missing fields
191
- {
192
- "zip": "94104",
193
- // street_address is missing
194
- "loan_number": "1231312",
195
- // city is missing
196
- "street_address2": "PMB 70879",
197
- "state": "California",
198
- "type": "Mortgagee"
199
- }
200
- ]
201
- }
202
- };
203
-
204
- // Call the method to test
205
- sge.socotra_update(retool_payload, template);
206
-
207
- // Verify that operations are populated correctly with available fields
208
-
209
- // Check addFieldGroups
210
- expect(template.addFieldGroups).toBeDefined();
211
- expect(template.addFieldGroups.length).toBe(1);
212
- expect(template.addFieldGroups[0]).toEqual({
213
- fieldName: "additional_insured",
214
- fieldValues: {
215
- type: "Mortgagee",
216
- // street_address is missing
217
- street_address2: "PMB 70879",
218
- // city is missing
219
- state: "California",
220
- zip: "94104",
221
- loan_number: "1231312"
222
- }
223
- });
224
- });
225
-
226
- test('Null values - should handle null values in the payload', () => {
227
- // Create an update template
228
- let template = SocotraEntry.socotra_create_update_template("exposure_locator");
229
-
230
- // Create a payload with null values
231
- let retool_payload = {
232
- additional_insured_data: {
233
- "additionalInterest": [
234
- // Add new field group with null values
235
- {
236
- "zip": "94104",
237
- "street_address": null,
238
- "loan_number": "1231312",
239
- "city": "San Francisco",
240
- "street_address2": null,
241
- "state": "California",
242
- "type": "Mortgagee"
243
- }
244
- ]
245
- }
246
- };
247
-
248
- // Call the method to test
249
- sge.socotra_update(retool_payload, template);
250
-
251
- // Verify that operations are populated correctly with non-null values
252
-
253
- // Check addFieldGroups
254
- expect(template.addFieldGroups).toBeDefined();
255
- expect(template.addFieldGroups.length).toBe(1);
256
- expect(template.addFieldGroups[0]).toEqual({
257
- fieldName: "additional_insured",
258
- fieldValues: {
259
- type: "Mortgagee",
260
- street_address: null,
261
- // street_address2 is null and should be included
262
- street_address2: null,
263
- city: "San Francisco",
264
- state: "California",
265
- zip: "94104",
266
- loan_number: "1231312"
267
- }
268
- });
269
- });
270
-
271
- // Tests for the new functionality with old_payload parameter
272
- test('With old_payload - should skip exact matches', () => {
273
- // Create an update template
274
- let template = SocotraEntry.socotra_create_update_template("exposure_locator");
275
-
276
- // Create a new payload with the same item as the old payload
277
- let retool_payload = {
278
- additional_insured_data: {
279
- "additionalInterest": [
280
- {
281
- "zip": "94104",
282
- "street_address": "548 Market Street",
283
- "loan_number": "1231312",
284
- "city": "San Francisco",
285
- "street_address2": "PMB 70879",
286
- "state": "California",
287
- "type": "Mortgagee"
288
- }
289
- ]
290
- }
291
- };
292
-
293
- // Create an old payload with the same item
294
- let old_payload = {
295
- additional_insured_data: {
296
- "additionalInterest": [
297
- {
298
- "zip": "94104",
299
- "street_address": "548 Market Street",
300
- "loan_number": "1231312",
301
- "city": "San Francisco",
302
- "street_address2": "PMB 70879",
303
- "state": "California",
304
- "type": "Mortgagee",
305
- "socotra_field_locator": "fg-123" // This should be ignored in comparison
306
- }
307
- ]
308
- }
309
- };
310
-
311
- // Call the method to test
312
- sge.socotra_update(retool_payload, template, old_payload);
313
-
314
- // Verify that no operations are added since the items match exactly
315
- expect(template.addFieldGroups).toBeUndefined();
316
- expect(template.removeFieldGroups).toBeUndefined();
317
- });
318
-
319
- test('With old_payload - should add entities only in new payload', () => {
320
- // Create an update template
321
- let template = SocotraEntry.socotra_create_update_template("exposure_locator");
322
-
323
- // Create a new payload with a new item
324
- let retool_payload = {
325
- additional_insured_data: {
326
- "additionalInterest": [
327
- {
328
- "zip": "94104",
329
- "street_address": "New Address",
330
- "loan_number": "1231312",
331
- "city": "San Francisco",
332
- "street_address2": "PMB 70879",
333
- "state": "California",
334
- "type": "Mortgagee"
335
- }
336
- ]
337
- }
338
- };
339
-
340
- // Create an old payload with a different item
341
- let old_payload = {
342
- additional_insured_data: {
343
- "additionalInterest": [
344
- {
345
- "zip": "98107",
346
- "street_address": "3430 NW 62nd st",
347
- "city": "Seattle",
348
- "state": "WA",
349
- "type": "LLC as Additional Insured",
350
- "socotra_field_locator": "fg-456"
351
- }
352
- ]
353
- }
354
- };
355
-
356
- // Call the method to test
357
- sge.socotra_update(retool_payload, template, old_payload);
358
-
359
- // Verify that the new item is added and the old item is removed
360
- expect(template.addFieldGroups).toBeDefined();
361
- expect(template.addFieldGroups.length).toBe(1);
362
- expect(template.addFieldGroups[0]).toEqual({
363
- fieldName: "additional_insured",
364
- fieldValues: {
365
- type: "Mortgagee",
366
- street_address: "New Address",
367
- street_address2: "PMB 70879",
368
- city: "San Francisco",
369
- state: "California",
370
- zip: "94104",
371
- loan_number: "1231312"
372
- }
373
- });
374
- expect(template.removeFieldGroups).toBeDefined();
375
- expect(template.removeFieldGroups.length).toBe(1);
376
- expect(template.removeFieldGroups).toContain("fg-456");
377
- });
378
-
379
- test('With old_payload - should remove entities only in old payload', () => {
380
- // Create an update template
381
- let template = SocotraEntry.socotra_create_update_template("exposure_locator");
382
-
383
- // Create a new payload with no items
384
- let retool_payload = {
385
- additional_insured_data: {
386
- "additionalInterest": []
387
- }
388
- };
389
-
390
- // Create an old payload with an item
391
- let old_payload = {
392
- additional_insured_data: {
393
- "additionalInterest": [
394
- {
395
- "zip": "98107",
396
- "street_address": "3430 NW 62nd st",
397
- "city": "Seattle",
398
- "state": "WA",
399
- "type": "LLC as Additional Insured",
400
- "socotra_field_locator": "fg-456"
401
- }
402
- ]
403
- }
404
- };
405
-
406
- // Call the method to test
407
- sge.socotra_update(retool_payload, template, old_payload);
408
-
409
- // Verify that the old item is removed
410
- expect(template.addFieldGroups).toBeUndefined();
411
- expect(template.removeFieldGroups).toBeDefined();
412
- expect(template.removeFieldGroups.length).toBe(1);
413
- expect(template.removeFieldGroups).toContain("fg-456");
414
- });
415
-
416
- test('With old_payload - should handle mixed scenarios', () => {
417
- // Create an update template
418
- let template = SocotraEntry.socotra_create_update_template("exposure_locator");
419
-
420
- // Create a new payload with mixed items (one match, one new)
421
- let retool_payload = {
422
- additional_insured_data: {
423
- "additionalInterest": [
424
- // This item matches an item in old_payload
425
- {
426
- "zip": "98107",
427
- "street_address": "3430 NW 62nd st",
428
- "city": "Seattle",
429
- "state": "WA",
430
- "type": "LLC as Additional Insured"
431
- },
432
- // This is a new item
433
- {
434
- "zip": "94104",
435
- "street_address": "New Address",
436
- "loan_number": "1231312",
437
- "city": "San Francisco",
438
- "street_address2": "PMB 70879",
439
- "state": "California",
440
- "type": "Mortgagee"
441
- }
442
- ]
443
- }
444
- };
445
-
446
- // Create an old payload with mixed items (one match, one to be removed)
447
- let old_payload = {
448
- additional_insured_data: {
449
- "additionalInterest": [
450
- // This item matches an item in retool_payload
451
- {
452
- "zip": "98107",
453
- "street_address": "3430 NW 62nd st",
454
- "city": "Seattle",
455
- "state": "WA",
456
- "type": "LLC as Additional Insured",
457
- "socotra_field_locator": "fg-456"
458
- },
459
- // This item is only in old_payload
460
- {
461
- "zip": "94104",
462
- "street_address": "548 Market Street",
463
- "loan_number": "8200867399",
464
- "city": "San Francisco",
465
- "street_address2": "PMB 70879",
466
- "state": "California",
467
- "type": "Mortgagee",
468
- "socotra_field_locator": "fg-123"
469
- }
470
- ]
471
- }
472
- };
473
-
474
- // Call the method to test
475
- sge.socotra_update(retool_payload, template, old_payload);
476
-
477
- // Verify that the new item is added and the old item is removed
478
- expect(template.addFieldGroups).toBeDefined();
479
- expect(template.addFieldGroups.length).toBe(1);
480
- expect(template.addFieldGroups[0]).toEqual({
481
- fieldName: "additional_insured",
482
- fieldValues: {
483
- type: "Mortgagee",
484
- street_address: "New Address",
485
- street_address2: "PMB 70879",
486
- city: "San Francisco",
487
- state: "California",
488
- zip: "94104",
489
- loan_number: "1231312"
490
- }
491
- });
492
- expect(template.removeFieldGroups).toBeDefined();
493
- expect(template.removeFieldGroups.length).toBe(1);
494
- expect(template.removeFieldGroups).toContain("fg-123");
495
- });
496
-
497
- test('With old_payload - should handle explicit remove operations', () => {
498
- // Create an update template
499
- let template = SocotraEntry.socotra_create_update_template("exposure_locator");
500
-
501
- // Create a new payload with an explicit remove operation
502
- let retool_payload = {
503
- additional_insured_data: {
504
- "additionalInterest": [
505
- // This is an explicit remove operation
506
- {
507
- "locator": "fg-789",
508
- "remove": true
509
- },
510
- // This is a new item
511
- {
512
- "zip": "94104",
513
- "street_address": "New Address",
514
- "loan_number": "1231312",
515
- "city": "San Francisco",
516
- "street_address2": "PMB 70879",
517
- "state": "California",
518
- "type": "Mortgagee"
519
- }
520
- ]
521
- }
522
- };
523
-
524
- // Create an old payload with an item
525
- let old_payload = {
526
- additional_insured_data: {
527
- "additionalInterest": [
528
- {
529
- "zip": "98107",
530
- "street_address": "3430 NW 62nd st",
531
- "city": "Seattle",
532
- "state": "WA",
533
- "type": "LLC as Additional Insured",
534
- "socotra_field_locator": "fg-456"
535
- }
536
- ]
537
- }
538
- };
539
-
540
- // Call the method to test
541
- sge.socotra_update(retool_payload, template, old_payload);
542
-
543
- // Verify that the new item is added, the old item is removed, and the explicit remove operation is processed
544
- expect(template.addFieldGroups).toBeDefined();
545
- expect(template.addFieldGroups.length).toBe(1);
546
- expect(template.addFieldGroups[0]).toEqual({
547
- fieldName: "additional_insured",
548
- fieldValues: {
549
- type: "Mortgagee",
550
- street_address: "New Address",
551
- street_address2: "PMB 70879",
552
- city: "San Francisco",
553
- state: "California",
554
- zip: "94104",
555
- loan_number: "1231312"
556
- }
557
- });
558
- expect(template.removeFieldGroups).toBeDefined();
559
- expect(template.removeFieldGroups.length).toBe(2);
560
- expect(template.removeFieldGroups).toContain("fg-456");
561
- expect(template.removeFieldGroups).toContain("fg-789");
562
- });
563
- });