@pdtf/schemas 2.0.0-22 → 2.0.0-24

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.
@@ -1962,9 +1962,24 @@
1962
1962
  "insurance": {
1963
1963
  "isInsured": {},
1964
1964
  "details": {},
1965
+ "landlordInsuresIfFlat": {},
1965
1966
  "difficultiesObtainingInsurance": {
1966
- "yesNo": {},
1967
- "details": {}
1967
+ "abnormalRiseInPremiums": {
1968
+ "yesNo": {},
1969
+ "details": {}
1970
+ },
1971
+ "subjectToHighExcesses": {
1972
+ "yesNo": {},
1973
+ "details": {}
1974
+ },
1975
+ "subjectToUnusualConditions": {
1976
+ "yesNo": {},
1977
+ "details": {}
1978
+ },
1979
+ "refused": {
1980
+ "yesNo": {},
1981
+ "details": {}
1982
+ }
1968
1983
  },
1969
1984
  "insuranceClaims": {
1970
1985
  "yesNo": {},
@@ -2099,6 +2114,10 @@
2099
2114
  "yesNo": {},
2100
2115
  "details": {},
2101
2116
  "attachments": {}
2117
+ },
2118
+ "otherCharges": {
2119
+ "yesNo": {},
2120
+ "details": {}
2102
2121
  }
2103
2122
  },
2104
2123
  "consumerProtectionRegulationsDeclaration": {
@@ -2237,34 +2256,42 @@
2237
2256
  "attachments": {}
2238
2257
  },
2239
2258
  "roofingWork": {
2240
- "yesNo": {}
2259
+ "yesNo": {},
2260
+ "attachments": {}
2241
2261
  },
2242
2262
  "dampProofingTreatment": {
2243
- "yesNo": {}
2263
+ "yesNo": {},
2264
+ "attachments": {}
2244
2265
  },
2245
2266
  "timberRotOrInfestationTreatment": {
2246
- "yesNo": {}
2267
+ "yesNo": {},
2268
+ "attachments": {}
2247
2269
  },
2248
2270
  "centralHeatingAndorPlumbing": {
2249
- "yesNo": {}
2271
+ "yesNo": {},
2272
+ "attachments": {}
2250
2273
  },
2251
2274
  "doubleGlazing": {
2252
- "yesNo": {}
2275
+ "yesNo": {},
2276
+ "attachments": {}
2253
2277
  },
2254
2278
  "electricalRepairOrInstallation": {
2255
- "yesNo": {}
2279
+ "yesNo": {},
2280
+ "attachments": {}
2256
2281
  },
2257
2282
  "subsidenceWork": {
2258
- "yesNo": {}
2283
+ "yesNo": {},
2284
+ "attachments": {}
2259
2285
  },
2260
2286
  "solarPanels": {
2261
- "yesNo": {}
2287
+ "yesNo": {},
2288
+ "attachments": {}
2262
2289
  },
2263
2290
  "otherGuarantees": {
2264
2291
  "yesNo": {},
2265
- "details": {}
2292
+ "details": {},
2293
+ "attachments": {}
2266
2294
  },
2267
- "willLeaveGuaranteePaperwork": {},
2268
2295
  "outstandingClaimsOrApplications": {
2269
2296
  "yesNo": {},
2270
2297
  "details": {},
@@ -2316,7 +2343,7 @@
2316
2343
  },
2317
2344
  "moveRestrictionDates": {
2318
2345
  "yesNo": {},
2319
- "restrictedDates": {}
2346
+ "details": {}
2320
2347
  },
2321
2348
  "digitalPropertyLogbook": {
2322
2349
  "yesNo": {},
@@ -111,7 +111,7 @@ test("correctly gets a subschema through a dependency", () => {
111
111
  schemaId
112
112
  );
113
113
  expect(subschema.title).toBe(
114
- "Provide details and likely timescale for delay (if known)"
114
+ "Provide details and likely timescale for delay"
115
115
  );
116
116
  });
117
117
 
@@ -167,6 +167,16 @@ test("correctly gets yes another subschema but through a non-baspi oneOf structu
167
167
  expect(subschema).toEqual({ type: "string" });
168
168
  });
169
169
 
170
+ test("correctly gets a subschema with multiple overlays", () => {
171
+ const subschema = getSubschema(
172
+ "/propertyPack/materialFacts/parking/parkingArrangements",
173
+ schemaId,
174
+ ["baspiV4", "ta6ed4"]
175
+ );
176
+ expect(subschema.baspiRef).toBe("A1.6.0");
177
+ expect(subschema.ta6Ref).toBe("9.1");
178
+ });
179
+
170
180
  test("correctly gets a subschema validator which is already cached", () => {
171
181
  const validator = getSubschemaValidator(
172
182
  "/propertyPack/materialFacts/energyEfficiency/certificate"
@@ -178,6 +188,32 @@ test("correctly gets a subschema validator which is already cached", () => {
178
188
  expect(anotherValidator).not.toBeNull();
179
189
  });
180
190
 
191
+ test("correctly gets a subschema validator for a TA6 overlay", () => {
192
+ const path = "/propertyPack";
193
+ const data = jp.get(exampleTransaction, path);
194
+ const validator = getSubschemaValidator(path, exampleTransaction.$schema, [
195
+ "ta6ed4",
196
+ ]);
197
+ let isValid = validator(data);
198
+ // console.log(validator.errors);
199
+ expect(isValid).toBe(true);
200
+ });
201
+
202
+ test("correctly gets a subschema validator for a TA6 overlay which validates", () => {
203
+ const path =
204
+ "/propertyPack/additionalLegalInfo/guaranteesWarrantiesAndIndemnityInsurances/subsidenceWork";
205
+ const subSchema = getSubschema(path, exampleTransaction.$schema, ["ta6ed4"]);
206
+ const data = { yesNo: "Yes" };
207
+ const validator = getSubschemaValidator(path, exampleTransaction.$schema, [
208
+ "ta6ed4",
209
+ ]);
210
+ let isValid = validator(data);
211
+ expect(isValid).toBe(false);
212
+ expect(validator.errors[0].message).toBe(
213
+ "must have required property 'attachments'"
214
+ );
215
+ });
216
+
181
217
  test("correctly gets a subschema validator which validates", () => {
182
218
  const path = "/propertyPack/materialFacts/notices";
183
219
  const validator = getSubschemaValidator(path);
@@ -71,7 +71,6 @@ const flattenSkeleton = (schema) => {
71
71
 
72
72
  const extractOverlay = (sourceSchema, ref) => {
73
73
  const refName = `${ref}Ref`;
74
- const refRequired = `${ref}Required`;
75
74
  const returnSchema = {
76
75
  $schema: "http://json-schema.org/draft-07/schema#",
77
76
  $id: `https://trust.propdata.org.uk/schemas/v2/overlays/${ref}.json`,
@@ -100,6 +99,7 @@ const extractOverlay = (sourceSchema, ref) => {
100
99
  });
101
100
  }
102
101
  }
102
+ const refRequired = `${ref}Required`;
103
103
  if (element[refRequired]) {
104
104
  jp.set(returnSchema, `${path}/required`, element[refRequired]);
105
105
  }