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.
- package/dist/stand_underwriter.js +1 -1
- package/package.json +8 -2
- package/__tests__/__utils__/load_payload.js +0 -16
- package/__tests__/__utils__/payloads/ai_additional_insured_new.json +0 -90
- package/__tests__/__utils__/payloads/ai_no_change_new_payload.json +0 -103
- package/__tests__/__utils__/payloads/ai_no_change_old_payload.json +0 -764
- package/__tests__/__utils__/payloads/ai_old_payload.json +0 -707
- package/__tests__/__utils__/payloads/claims_new_policy.json +0 -117
- package/__tests__/__utils__/payloads/claims_remove_new_payload.json +0 -68
- package/__tests__/__utils__/payloads/claims_remove_socotra_policy.json +0 -785
- package/__tests__/__utils__/payloads/claims_socotra_payload.json +0 -764
- package/__tests__/__utils__/payloads/minimal_change_base.json +0 -574
- package/__tests__/__utils__/payloads/minimal_change_base2.json +0 -574
- package/__tests__/__utils__/payloads/minimal_change_resulting_socotra.json +0 -17
- package/__tests__/__utils__/payloads/minimal_change_resulting_socotra2.json +0 -27
- package/__tests__/__utils__/payloads/minimal_change_retool.json +0 -37
- package/__tests__/__utils__/payloads/minimal_change_retool2.json +0 -27
- package/__tests__/__utils__/payloads/sample_minimal_retool.json +0 -33
- package/__tests__/__utils__/payloads/sample_minimal_socotra_payload.json +0 -116
- package/__tests__/__utils__/payloads/sample_new_policy_holder.json +0 -17
- package/__tests__/__utils__/payloads/sample_new_quote.json +0 -216
- package/__tests__/__utils__/payloads/sample_new_quote_retool.json +0 -93
- package/__tests__/__utils__/payloads/sample_retool.json +0 -157
- package/__tests__/__utils__/payloads/sample_retool_converted_quote.json +0 -54
- package/__tests__/__utils__/payloads/sample_retool_socotra_subset.json +0 -163
- package/__tests__/__utils__/payloads/sample_socotra_quote.json +0 -782
- package/__tests__/__utils__/payloads/sample_socotra_with_additional_insured.json +0 -764
- package/__tests__/__utils__/payloads/sample_update_quote.json +0 -18
- package/__tests__/__utils__/payloads/versions/v1/sample_new_quote.json +0 -211
- package/__tests__/__utils__/payloads/versions/v1/sample_retool.json +0 -160
- package/__tests__/__utils__/payloads/versions/v1/sample_retool_socotra_subset.json +0 -128
- package/__tests__/__utils__/payloads/versions/v1/sample_socotra_quote.json +0 -776
- package/__tests__/__utils__/payloads/versions/v1/sample_update_quote.json +0 -18
- package/__tests__/__utils__/payloads/versions/v2/sample_new_quote.json +0 -215
- package/__tests__/__utils__/payloads/versions/v2/sample_retool.json +0 -165
- package/__tests__/__utils__/payloads/versions/v2/sample_retool_socotra_subset.json +0 -159
- package/__tests__/__utils__/payloads/versions/v2/sample_socotra_quote.json +0 -779
- package/__tests__/__utils__/payloads/versions/v2/sample_update_quote.json +0 -18
- package/__tests__/basic_knockout.test.js +0 -113
- package/__tests__/claims_history_knockout.test.js +0 -56
- package/__tests__/exterior_knockout.test.js +0 -192
- package/__tests__/helpers/index.js +0 -10
- package/__tests__/home_owner_knockouts.js +0 -260
- package/__tests__/interior_knockout.test.js +0 -321
- package/__tests__/package_version.test.js +0 -7
- package/__tests__/rate_call_knockouts.test.js +0 -347
- package/__tests__/retool_utils/socotra_group_update.test.js +0 -563
- package/__tests__/retool_utils/socotra_payload.test.js +0 -270
- package/__tests__/retool_utils/socotra_structure_helper.test.js +0 -242
- package/__tests__/retool_utils/versions/entries_v1.test.js +0 -51
- package/__tests__/retool_utils/versions/entries_v2.test.js +0 -51
- package/__tests__/underwriter.test.js +0 -169
- package/__tests__/wf_knockout.test.js +0 -124
- package/src/index.js +0 -14
- package/src/knockouts/basic_knockouts.js +0 -66
- package/src/knockouts/claims_history_knockout.js +0 -24
- package/src/knockouts/exterior_knockouts.js +0 -97
- package/src/knockouts/home_owner_knockouts.js +0 -118
- package/src/knockouts/index.js +0 -83
- package/src/knockouts/interior_knockouts.js +0 -149
- package/src/knockouts/rate_call_knockouts.js +0 -155
- package/src/knockouts/wf_knockouts.js +0 -66
- package/src/retool_to_socotra.js +0 -18
- package/src/retool_utils/socotra_entries_helper_fuctions.js +0 -0
- package/src/retool_utils/socotra_payloads.js +0 -161
- package/src/retool_utils/socotra_structure_helper.js +0 -687
- package/src/retool_utils/versions/stand_v1_entries.js +0 -167
- package/src/retool_utils/versions/stand_v2_entries.js +0 -211
- package/src/retool_utils/versions/stand_v3_entries.js +0 -274
- package/src/underwriter.js +0 -86
- package/webpack.config.js +0 -14
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"paymentScheduleName": "upfront",
|
|
3
|
-
"updateExposures": [
|
|
4
|
-
{
|
|
5
|
-
"exposureLocator": "81f6f009-87bc-435e-aac7-269e240ecbb2",
|
|
6
|
-
"fieldValues": {
|
|
7
|
-
"protection_class": "3",
|
|
8
|
-
"dead_bolt": "No"
|
|
9
|
-
},
|
|
10
|
-
"fieldGroups": []
|
|
11
|
-
}
|
|
12
|
-
],
|
|
13
|
-
"name": "example name",
|
|
14
|
-
"fieldValues": {
|
|
15
|
-
"coverage_b": 300000,
|
|
16
|
-
"zip": "94655"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
const { knockout } = require('../src/knockouts/index.js');
|
|
2
|
-
|
|
3
|
-
describe("Basic Knockouts", () =>
|
|
4
|
-
{
|
|
5
|
-
test('first simple test', () => {
|
|
6
|
-
let decision = knockout('a', 'b');
|
|
7
|
-
expect(decision.decision).toBe("question_not_found");
|
|
8
|
-
expect(decision.note).toBe(null)
|
|
9
|
-
});
|
|
10
|
-
describe("query_multi_family", () => {
|
|
11
|
-
test('rejects more than 2', () => {
|
|
12
|
-
let decision = knockout('multi_family_unit_count', 3);
|
|
13
|
-
expect(decision.decision).toBe("reject");
|
|
14
|
-
expect(decision.note).toBe("We only allow homes with two units or less.")
|
|
15
|
-
});
|
|
16
|
-
test('accepts 0 - 2', () => {
|
|
17
|
-
let decision = knockout('multi_family_unit_count', 1);
|
|
18
|
-
expect(decision.decision).toBe("accept");
|
|
19
|
-
expect(decision.note).toBe(null)
|
|
20
|
-
});
|
|
21
|
-
test('rejects < 0', () => {
|
|
22
|
-
let decision = knockout('multi_family_unit_count', 0);
|
|
23
|
-
expect(decision.decision).toBe("reject");
|
|
24
|
-
expect(decision.note).toBe("Number of units must be greater than 0")
|
|
25
|
-
});
|
|
26
|
-
test('rejects if value is not an integer', () => {
|
|
27
|
-
let decision = knockout('multi_family_unit_count', "hi");
|
|
28
|
-
expect(decision.decision).toBe("reject");
|
|
29
|
-
expect(decision.note).toBe("Number of units must be an integer")
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
describe("primary_dwelling_insured", () => {
|
|
34
|
-
test('refers if no', () => {
|
|
35
|
-
let decision = knockout('primary_dwelling_insured', "No");
|
|
36
|
-
expect(decision.decision).toBe("refer");
|
|
37
|
-
expect(decision.note).toBe(null)
|
|
38
|
-
});
|
|
39
|
-
test('accepts if yes', () => {
|
|
40
|
-
let decision = knockout('primary_dwelling_insured', "Yes");
|
|
41
|
-
expect(decision.decision).toBe("accept");
|
|
42
|
-
expect(decision.note).toBe(null)
|
|
43
|
-
});
|
|
44
|
-
test('rejects if not yes or no', () => {
|
|
45
|
-
let decision = knockout('primary_dwelling_insured', 0);
|
|
46
|
-
expect(decision.decision).toBe("reject");
|
|
47
|
-
expect(decision.note).toBe("Primary dwelling insured value must be in ['yes', 'no']")
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
describe("full_replacement_value", () => {
|
|
52
|
-
test('rejects if < $2M', () => {
|
|
53
|
-
let decision = knockout('full_replacement_value', 1_900_000);
|
|
54
|
-
expect(decision.decision).toBe("reject");
|
|
55
|
-
expect(decision.note).toBe("We only insure homes greater than $1M")
|
|
56
|
-
});
|
|
57
|
-
test('refer if > $6M', () => {
|
|
58
|
-
let decision = knockout('full_replacement_value', 6_500_000);
|
|
59
|
-
expect(decision.decision).toBe("refer");
|
|
60
|
-
expect(decision.note).toBe(null)
|
|
61
|
-
});
|
|
62
|
-
test('accept if between $2M and $6M', () => {
|
|
63
|
-
let decision = knockout('full_replacement_value', 3_000_000);
|
|
64
|
-
expect(decision.decision).toBe("accept");
|
|
65
|
-
expect(decision.note).toBe(null)
|
|
66
|
-
});
|
|
67
|
-
test('rejects if not yes or no', () => {
|
|
68
|
-
let decision = knockout('full_replacement_value', "some string");
|
|
69
|
-
expect(decision.decision).toBe("reject");
|
|
70
|
-
expect(decision.note).toBe("Full replacement value must be an integer")
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
describe("prior_carrier", () => {
|
|
75
|
-
test('accept if they had one', () => {
|
|
76
|
-
let decision = knockout('prior_carrier', "Safeco");
|
|
77
|
-
expect(decision.decision).toBe("accept");
|
|
78
|
-
expect(decision.note).toBe(null)
|
|
79
|
-
});
|
|
80
|
-
test('refer if they did not', () => {
|
|
81
|
-
let decision = knockout('prior_carrier', "");
|
|
82
|
-
expect(decision.decision).toBe("refer");
|
|
83
|
-
expect(decision.note).toBe(null)
|
|
84
|
-
});
|
|
85
|
-
test('reject if they put something in other than a string', () => {
|
|
86
|
-
let decision = knockout('prior_carrier', 3_000_000);
|
|
87
|
-
expect(decision.decision).toBe("reject");
|
|
88
|
-
expect(decision.note).toBe("Prior Carrier Must be a string")
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
describe("occupation", () => {
|
|
93
|
-
test('accept if its not high profile', () => {
|
|
94
|
-
let decision = knockout('occupation', "Writer");
|
|
95
|
-
expect(decision.decision).toBe("accept");
|
|
96
|
-
expect(decision.note).toBe(null)
|
|
97
|
-
});
|
|
98
|
-
test('refer if they are a professional athlete, entertainer, journalist, politician', () => {
|
|
99
|
-
let decision = knockout('occupation', "Entertainer");
|
|
100
|
-
expect(decision.decision).toBe("refer");
|
|
101
|
-
expect(decision.note).toBe(null)
|
|
102
|
-
|
|
103
|
-
decision = knockout('occupation', "Professional Athlete");
|
|
104
|
-
expect(decision.decision).toBe("refer");
|
|
105
|
-
expect(decision.note).toBe(null)
|
|
106
|
-
});
|
|
107
|
-
test('reject if they put something in other than a string', () => {
|
|
108
|
-
let decision = knockout('occupation', 3_000_000);
|
|
109
|
-
expect(decision.decision).toBe("reject");
|
|
110
|
-
expect(decision.note).toBe("Occupation must be a string")
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
})
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
const {check_claims_history} = require("../src/knockouts/claims_history_knockout");
|
|
2
|
-
const {claims_history_helper} = require("./helpers")
|
|
3
|
-
|
|
4
|
-
beforeAll(() => {
|
|
5
|
-
jest
|
|
6
|
-
.useFakeTimers()
|
|
7
|
-
.setSystemTime(new Date('2024-07-04').getTime());
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
afterAll(() => {
|
|
11
|
-
jest.useRealTimers();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
describe('Claims History Knockouts', () => {
|
|
15
|
-
test('passes if empty', () => {
|
|
16
|
-
let decision = check_claims_history([])
|
|
17
|
-
expect(decision.note).toBe(null)
|
|
18
|
-
expect(decision.decision).toBe("accept");
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test('reject if three claims in past 5 years', () => {
|
|
22
|
-
let decision = check_claims_history([
|
|
23
|
-
claims_history_helper('06/23/2022', 'Hurricane', 100),
|
|
24
|
-
claims_history_helper('11/1/2020', 'SlipFall', 100),
|
|
25
|
-
claims_history_helper('11/1/2020', 'Dog Bite', 100),
|
|
26
|
-
|
|
27
|
-
])
|
|
28
|
-
expect(decision.note).toBe("To many claims in the past 5 years")
|
|
29
|
-
expect(decision.decision).toBe("reject");
|
|
30
|
-
});
|
|
31
|
-
test('accept if three claims but some older than 5 years', () => {
|
|
32
|
-
let decision = check_claims_history([
|
|
33
|
-
claims_history_helper('06/23/2022', 'Hurricane', 100),
|
|
34
|
-
claims_history_helper('11/1/2020', 'SlipFall', 100),
|
|
35
|
-
claims_history_helper('11/1/2015', 'Dog Bite', 100),
|
|
36
|
-
|
|
37
|
-
])
|
|
38
|
-
expect(decision.note).toBe(null)
|
|
39
|
-
expect(decision.decision).toBe("accept");
|
|
40
|
-
});
|
|
41
|
-
test('accept if three claims but some older than 3 years', () => {
|
|
42
|
-
let decision = check_claims_history([
|
|
43
|
-
claims_history_helper('06/23/2022', 'Hurricane', 100),
|
|
44
|
-
claims_history_helper('11/1/2022', 'SlipFall', 100),
|
|
45
|
-
|
|
46
|
-
])
|
|
47
|
-
expect(decision.note).toBe("To many claims in the past 3 years")
|
|
48
|
-
expect(decision.decision).toBe("reject");
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test('reject if null is passed', () => {
|
|
52
|
-
let decision = check_claims_history(null)
|
|
53
|
-
expect(decision.note).toBe("For Claims use empty instead of null")
|
|
54
|
-
expect(decision.decision).toBe("reject");
|
|
55
|
-
});
|
|
56
|
-
});
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
const { knockout } = require('../src/knockouts/index.js');
|
|
2
|
-
describe("Exterior Knockouts", () =>
|
|
3
|
-
{
|
|
4
|
-
describe("distance_to_coast", () => {
|
|
5
|
-
|
|
6
|
-
test('accept if distance to coast is >.19mi', () => {
|
|
7
|
-
let decision = knockout('distance_to_coast', .2);
|
|
8
|
-
expect(decision.decision).toBe("accept");
|
|
9
|
-
expect(decision.note).toBe(null)
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test('refer if distance to coast < .19 mi', () => {
|
|
13
|
-
let decision = knockout('distance_to_coast', 0.18);
|
|
14
|
-
expect(decision.decision).toBe("refer");
|
|
15
|
-
expect(decision.note).toBe(null)
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test('rejects if value is not an number', () => {
|
|
19
|
-
let decision = knockout('distance_to_coast', "hi");
|
|
20
|
-
expect(decision.decision).toBe("reject");
|
|
21
|
-
expect(decision.note).toBe("Distance to coast must be a number.")
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test('rejects if value is negative', () => {
|
|
25
|
-
let decision = knockout('distance_to_coast', -3);
|
|
26
|
-
expect(decision.decision).toBe("reject");
|
|
27
|
-
expect(decision.note).toBe("Distance to coast must be a positive number.")
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
describe("flood_score", () => {
|
|
32
|
-
|
|
33
|
-
test('accept if flood score is less than 9', () => {
|
|
34
|
-
let decision = knockout('flood_score', 8);
|
|
35
|
-
expect(decision.decision).toBe("accept");
|
|
36
|
-
expect(decision.note).toBe(null)
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
test('reject if flood score is too high', () => {
|
|
40
|
-
let decision = knockout('flood_score', 9);
|
|
41
|
-
expect(decision.decision).toBe("reject");
|
|
42
|
-
expect(decision.note).toBe("Flood risk is too high")
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
test('rejects if value is not an number', () => {
|
|
46
|
-
let decision = knockout('flood_score', "hi");
|
|
47
|
-
expect(decision.decision).toBe("reject");
|
|
48
|
-
expect(decision.note).toBe("Flood score must be a number.")
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test('rejects if value is negative', () => {
|
|
52
|
-
let decision = knockout('flood_score', -3);
|
|
53
|
-
expect(decision.decision).toBe("reject");
|
|
54
|
-
expect(decision.note).toBe("Flood score must be a positive number.")
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
describe("pool_features", () => {
|
|
59
|
-
test('refer if it has a diving board', () => {
|
|
60
|
-
let decision = knockout('pool_features', ["Diving Board", "Inground", "Fenced with self-locking gate"]);
|
|
61
|
-
expect(decision.decision).toBe("refer");
|
|
62
|
-
expect(decision.note).toBe(null)
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test('refer if it has a slide', () => {
|
|
66
|
-
let decision = knockout('pool_features', ["Slide", "Inground", "Fenced with self-locking gate"]);
|
|
67
|
-
expect(decision.decision).toBe("refer");
|
|
68
|
-
expect(decision.note).toBe(null)
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test('refer if doesnt have one of ladder, locking gate, or safety cover', () => {
|
|
72
|
-
let decision = knockout('pool_features', ["Inground"]);
|
|
73
|
-
expect(decision.decision).toBe("refer");
|
|
74
|
-
expect(decision.note).toBe(null)
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
test('accept if its inground with cover', () => {
|
|
78
|
-
let decision = knockout('pool_features', ["Inground", "Electric retractable safety cover"]);
|
|
79
|
-
expect(decision.decision).toBe("accept");
|
|
80
|
-
expect(decision.note).toBe(null)
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
test('accept if its inground with fence', () => {
|
|
84
|
-
let decision = knockout('pool_features', ["Inground", "Fenced with self-locking gate"]);
|
|
85
|
-
expect(decision.decision).toBe("accept");
|
|
86
|
-
expect(decision.note).toBe(null)
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
test('accept if its above ground with retractable ladder', () => {
|
|
90
|
-
let decision = knockout('pool_features', ["Above Ground", "Retractable/removable ladder"]);
|
|
91
|
-
expect(decision.decision).toBe("accept");
|
|
92
|
-
expect(decision.note).toBe(null)
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
test('rejects if value is not a list', () => {
|
|
96
|
-
let decision = knockout('pool_features', "hi");
|
|
97
|
-
expect(decision.decision).toBe("reject");
|
|
98
|
-
expect(decision.note).toBe("Pool features must be a list.")
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
describe("farming_type", () => {
|
|
103
|
-
|
|
104
|
-
test('accept type other than vineyard an produces income', () => {
|
|
105
|
-
let decision = knockout('farming_type', "None");
|
|
106
|
-
expect(decision.decision).toBe("accept");
|
|
107
|
-
expect(decision.note).toBe(null)
|
|
108
|
-
|
|
109
|
-
decision = knockout('farming_type', "Incidental or hobby farming");
|
|
110
|
-
expect(decision.decision).toBe("accept");
|
|
111
|
-
expect(decision.note).toBe(null)
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
test('refer vineyard', () => {
|
|
115
|
-
let decision = knockout('farming_type', "Vineyard");
|
|
116
|
-
expect(decision.decision).toBe("refer");
|
|
117
|
-
expect(decision.note).toBe(null)
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
test('reject commercial farms', () => {
|
|
121
|
-
let decision = knockout('farming_type', "Farming activities produce income");
|
|
122
|
-
expect(decision.decision).toBe("reject");
|
|
123
|
-
expect(decision.note).toBe("Cannot insure commercial farms")
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
test('rejects if value is not an string', () => {
|
|
127
|
-
let decision = knockout('farming_type', 3);
|
|
128
|
-
expect(decision.decision).toBe("reject");
|
|
129
|
-
expect(decision.note).toBe("Farming type must be a string")
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
test('rejects if value is not in accepted enum', () => {
|
|
133
|
-
let decision = knockout('farming_type', "hi");
|
|
134
|
-
expect(decision.decision).toBe("reject");
|
|
135
|
-
expect(decision.note).toBe("Farming type must be in [Farming activities produce income,Incidental or hobby farming,Vineyard,None]")
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
describe("has_attractive_nuisance", () => {
|
|
140
|
-
|
|
141
|
-
test('accept if no nuisance', () => {
|
|
142
|
-
let decision = knockout('has_attractive_nuisance', "No");
|
|
143
|
-
expect(decision.decision).toBe("accept");
|
|
144
|
-
expect(decision.note).toBe(null)
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
test('refer if they have an attractive_nuisance', () => {
|
|
148
|
-
let decision = knockout('has_attractive_nuisance', "Yes");
|
|
149
|
-
expect(decision.decision).toBe("refer");
|
|
150
|
-
expect(decision.note).toBe(null)
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
test('rejects if value is not yes or no', () => {
|
|
154
|
-
let decision = knockout('has_attractive_nuisance', "hi");
|
|
155
|
-
expect(decision.decision).toBe("reject");
|
|
156
|
-
expect(decision.note).toBe("Has attractive nuisance must be Yes or No.")
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
test('rejects if value is number', () => {
|
|
160
|
-
let decision = knockout('has_attractive_nuisance', -4);
|
|
161
|
-
expect(decision.decision).toBe("reject");
|
|
162
|
-
expect(decision.note).toBe("Has attractive nuisance must be Yes or No.")
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
describe("degree_of_slope", () => {
|
|
167
|
-
|
|
168
|
-
test('accept if slope <= than 30', () => {
|
|
169
|
-
let decision = knockout('degree_of_slope', 30);
|
|
170
|
-
expect(decision.decision).toBe("accept");
|
|
171
|
-
expect(decision.note).toBe(null)
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
test('reject if slope > 30', () => {
|
|
175
|
-
let decision = knockout('degree_of_slope', 35);
|
|
176
|
-
expect(decision.decision).toBe("reject");
|
|
177
|
-
expect(decision.note).toBe("Slope greater than 30 degrees")
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
test('rejects if value is not an number', () => {
|
|
181
|
-
let decision = knockout('degree_of_slope', "hi");
|
|
182
|
-
expect(decision.decision).toBe("reject");
|
|
183
|
-
expect(decision.note).toBe("Degree of slope must be a number.")
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
test('rejects if value is negative', () => {
|
|
187
|
-
let decision = knockout('degree_of_slope', -3);
|
|
188
|
-
expect(decision.decision).toBe("reject");
|
|
189
|
-
expect(decision.note).toBe("Degree of slope must be a positive number.")
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
})
|
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
const { knockout } = require('../src/knockouts/index.js');
|
|
2
|
-
const {same_address } = require('../src/knockouts/home_owner_knockouts')
|
|
3
|
-
describe("Exterior Knockouts", () =>
|
|
4
|
-
{
|
|
5
|
-
describe("number_of_dogs", () => {
|
|
6
|
-
|
|
7
|
-
test('accept if number of dogs is < 4', () => {
|
|
8
|
-
let decision = knockout('number_of_dogs', 2);
|
|
9
|
-
expect(decision.decision).toBe("accept");
|
|
10
|
-
expect(decision.note).toBe(null)
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test('refer if number of dogs is greater than 4', () => {
|
|
14
|
-
let decision = knockout('number_of_dogs', 4);
|
|
15
|
-
expect(decision.decision).toBe("reject");
|
|
16
|
-
expect(decision.note).toBe("Owner has 4 or more dogs")
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
test('rejects if value is not an number', () => {
|
|
20
|
-
let decision = knockout('number_of_dogs', "hi");
|
|
21
|
-
expect(decision.decision).toBe("reject");
|
|
22
|
-
expect(decision.note).toBe("Number of dogs must be a number.")
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
test('rejects if value is negative', () => {
|
|
26
|
-
let decision = knockout('number_of_dogs', -3);
|
|
27
|
-
expect(decision.decision).toBe("reject");
|
|
28
|
-
expect(decision.note).toBe("Number of dogs must be a positive number.")
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
describe("dog_has_history", () => {
|
|
33
|
-
|
|
34
|
-
test('accept if no history', () => {
|
|
35
|
-
let decision = knockout('dog_history', "No");
|
|
36
|
-
expect(decision.decision).toBe("accept");
|
|
37
|
-
expect(decision.note).toBe(null)
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
test('reject if dog has history', () => {
|
|
41
|
-
let decision = knockout('dog_history', "Yes");
|
|
42
|
-
expect(decision.decision).toBe("reject");
|
|
43
|
-
expect(decision.note).toBe("Has a dog with a history of aggressive behavior")
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
test('rejects if value is not yes or no', () => {
|
|
47
|
-
let decision = knockout('dog_history', "hi");
|
|
48
|
-
expect(decision.decision).toBe("reject");
|
|
49
|
-
expect(decision.note).toBe("Dog has history must be Yes or No.")
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
test('rejects if value is number', () => {
|
|
53
|
-
let decision = knockout('dog_history', -4);
|
|
54
|
-
expect(decision.decision).toBe("reject");
|
|
55
|
-
expect(decision.note).toBe("Dog has history must be Yes or No.")
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
describe("dog_breeds", () => {
|
|
60
|
-
|
|
61
|
-
test('accept if no dogs', () => {
|
|
62
|
-
let decision = knockout('dog_breeds', []);
|
|
63
|
-
expect(decision.decision).toBe("accept");
|
|
64
|
-
expect(decision.note).toBe(null)
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
test('accept if all dogs non-guard dogs of other breeds', () => {
|
|
68
|
-
let decision = knockout('dog_breeds', ["non-guard dog of other breeds",
|
|
69
|
-
"non-guard dog of other breeds"]);
|
|
70
|
-
expect(decision.decision).toBe("accept");
|
|
71
|
-
expect(decision.note).toBe(null)
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
test('reject one non-guard dogs one other', () => {
|
|
75
|
-
let decision = knockout('dog_breeds', ["non-guard dog of other breeds",
|
|
76
|
-
"non-guard dog of other breeds","Akita"]);
|
|
77
|
-
expect(decision.decision).toBe("reject");
|
|
78
|
-
expect(decision.note).toBe("Dog of given breed not allowed")
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
test('reject if gaurd dog', () => {
|
|
82
|
-
let decision = knockout('dog_breeds', ["Chow"]);
|
|
83
|
-
expect(decision.decision).toBe("reject");
|
|
84
|
-
expect(decision.note).toBe("Dog of given breed not allowed")
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
test('rejects if value is not list', () => {
|
|
88
|
-
let decision = knockout('dog_breeds', -4);
|
|
89
|
-
expect(decision.decision).toBe("reject");
|
|
90
|
-
expect(decision.note).toBe("Dog breed must be a list")
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
describe("exotic_pets", () => {
|
|
95
|
-
|
|
96
|
-
test('accept if no exotic pets', () => {
|
|
97
|
-
let decision = knockout('exotic_pets', "No");
|
|
98
|
-
expect(decision.decision).toBe("accept");
|
|
99
|
-
expect(decision.note).toBe(null)
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
test('reject if they have exotic pets', () => {
|
|
103
|
-
let decision = knockout('exotic_pets', "Yes");
|
|
104
|
-
expect(decision.decision).toBe("reject");
|
|
105
|
-
expect(decision.note).toBe("Has an exotic pet")
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
test('rejects if value is not yes or no', () => {
|
|
109
|
-
let decision = knockout('exotic_pets', "hi");
|
|
110
|
-
expect(decision.decision).toBe("reject");
|
|
111
|
-
expect(decision.note).toBe("Has exotic pet must be Yes or No.")
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
test('rejects if value is number', () => {
|
|
115
|
-
let decision = knockout('exotic_pets', -4);
|
|
116
|
-
expect(decision.decision).toBe("reject");
|
|
117
|
-
expect(decision.note).toBe("Has exotic pet must be Yes or No.")
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
describe("number_of_mortgages", () => {
|
|
122
|
-
|
|
123
|
-
test('accept if number of mortgages is < 2', () => {
|
|
124
|
-
let decision = knockout('number_of_mortgages', 1);
|
|
125
|
-
expect(decision.decision).toBe("accept");
|
|
126
|
-
expect(decision.note).toBe(null)
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
test('refer if number of mortgages is greater than or equals to 2', () => {
|
|
130
|
-
let decision = knockout('number_of_mortgages', 2);
|
|
131
|
-
expect(decision.decision).toBe("refer");
|
|
132
|
-
expect(decision.note).toBe(null)
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
test('rejects if value is not an number', () => {
|
|
136
|
-
let decision = knockout('number_of_mortgages', "hi");
|
|
137
|
-
expect(decision.decision).toBe("reject");
|
|
138
|
-
expect(decision.note).toBe("Number of mortgages must be a number.")
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
test('rejects if value is negative', () => {
|
|
142
|
-
let decision = knockout('number_of_mortgages', -1);
|
|
143
|
-
expect(decision.decision).toBe("reject");
|
|
144
|
-
expect(decision.note).toBe("Number of mortgages must be a positive number.")
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
describe("number_of_bankruptcies_judgements_or_liens", () => {
|
|
149
|
-
|
|
150
|
-
test('accept if number of bankruptcies, judgements or liens is 0', () => {
|
|
151
|
-
let decision = knockout('number_of_bankruptcies_judgements_or_liens', 0);
|
|
152
|
-
expect(decision.decision).toBe("accept");
|
|
153
|
-
expect(decision.note).toBe(null)
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
test('reject if there are any bankruptcies, judgements or liens', () => {
|
|
157
|
-
let decision = knockout('number_of_bankruptcies_judgements_or_liens', 1);
|
|
158
|
-
expect(decision.decision).toBe("reject");
|
|
159
|
-
expect(decision.note).toBe("Has bankruptcies, judgements, or liens")
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
test('rejects if value is not a number', () => {
|
|
163
|
-
let decision = knockout('number_of_bankruptcies_judgements_or_liens', "hi");
|
|
164
|
-
expect(decision.decision).toBe("reject");
|
|
165
|
-
expect(decision.note).toBe("Number of bankruptcies, judgements, or liens must be a number")
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
test('rejects if value is negative', () => {
|
|
169
|
-
let decision = knockout('number_of_bankruptcies_judgements_or_liens', -3);
|
|
170
|
-
expect(decision.decision).toBe("reject");
|
|
171
|
-
expect(decision.note).toBe("Number of bankruptcies, judgements, or liens must be a positive number")
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
describe("home_bussiness_type", () => {
|
|
176
|
-
|
|
177
|
-
test('accept no business', () => {
|
|
178
|
-
let decision = knockout('home_business_type', "no");
|
|
179
|
-
expect(decision.decision).toBe("accept");
|
|
180
|
-
expect(decision.note).toBe(null)
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
test('refer yes other', () => {
|
|
184
|
-
let decision = knockout('home_business_type', "yes - other");
|
|
185
|
-
expect(decision.decision).toBe("refer");
|
|
186
|
-
expect(decision.note).toBe(null)
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
test('reject day_care', () => {
|
|
190
|
-
let decision = knockout('home_business_type', "yes - day care");
|
|
191
|
-
expect(decision.decision).toBe("reject");
|
|
192
|
-
expect(decision.note).toBe("Cannot insure daycare")
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
test('rejects if value is not an string', () => {
|
|
196
|
-
let decision = knockout('home_business_type', 3);
|
|
197
|
-
expect(decision.decision).toBe("reject");
|
|
198
|
-
expect(decision.note).toBe("Home business type must be a string")
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
test('rejects if value is not in accepted enum', () => {
|
|
202
|
-
let decision = knockout('home_business_type', "hi");
|
|
203
|
-
expect(decision.decision).toBe("reject");
|
|
204
|
-
expect(decision.note).toBe("Home business type must be in [yes - day care, yes - other, no]")
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
describe("home_rental_type", () => {
|
|
209
|
-
|
|
210
|
-
test('accept no rentals', () => {
|
|
211
|
-
let decision = knockout('home_rental_type', "no");
|
|
212
|
-
expect(decision.decision).toBe("accept");
|
|
213
|
-
expect(decision.note).toBe(null)
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
test('refer yes other', () => {
|
|
217
|
-
let decision = knockout('home_rental_type', "short-term rentals less than 6 months of the year");
|
|
218
|
-
expect(decision.decision).toBe("refer");
|
|
219
|
-
expect(decision.note).toBe(null)
|
|
220
|
-
|
|
221
|
-
decision = knockout('home_rental_type', "timeshare");
|
|
222
|
-
expect(decision.decision).toBe("refer");
|
|
223
|
-
expect(decision.note).toBe(null)
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
test('reject day_care', () => {
|
|
227
|
-
let decision = knockout('home_rental_type', "short term rentals more than 6 months of the year");
|
|
228
|
-
expect(decision.decision).toBe("reject");
|
|
229
|
-
expect(decision.note).toBe("Cannot insure rentals longer than 6 months")
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
test('rejects if value is not an string', () => {
|
|
233
|
-
let decision = knockout('home_rental_type', 3);
|
|
234
|
-
expect(decision.decision).toBe("reject");
|
|
235
|
-
expect(decision.note).toBe("Home rental type must be a string")
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
test('rejects if value is not in accepted enum', () => {
|
|
239
|
-
let decision = knockout('home_rental_type', "hi");
|
|
240
|
-
expect(decision.decision).toBe("reject");
|
|
241
|
-
expect(decision.note).toBe("Home rental type must be in [short-term rentals less than 6 months of the year, short term rentals more than 6 months of the year, timeshare, no]")
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
describe('same_address', () => {
|
|
246
|
-
test('accept if address is the same', () => {
|
|
247
|
-
let decision = same_address('123 main street', '123 main street')
|
|
248
|
-
expect(decision.decision).toBe("accept");
|
|
249
|
-
expect(decision.note).toBe(null)
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
test('reject if address is not the same', () => {
|
|
253
|
-
let decision = same_address('123 main street', '123 krill street')
|
|
254
|
-
expect(decision.decision).toBe("reject");
|
|
255
|
-
expect(decision.note).toBe("Co-Applicant must have same address as Applicant.")
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
})
|