@pdtf/schemas 0.5.0

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.
@@ -0,0 +1,363 @@
1
+ {
2
+ "$schema": "https://homebuyingandsellinggroup.co.uk/schemas/property-pack.json",
3
+ "uprn": 100000059583,
4
+ "propertyPack": {
5
+ "materialFacts": {
6
+ "propertyToBeSold": {
7
+ "address": {
8
+ "address1": "10 Downend Park",
9
+ "address2": "",
10
+ "town": "BRISTOLS",
11
+ "county": "Avon",
12
+ "postcode": "BS7 9PU"
13
+ },
14
+ "energyEfficiency": {
15
+ "energyEfficiencyRating": "A"
16
+ },
17
+ "delayFactors": {
18
+ "yesNo": "No"
19
+ },
20
+ "ownership": {
21
+ "ownershipType": "Freehold"
22
+ },
23
+ "parkingArrangements": {
24
+ "parkingArrangementsType": "Other",
25
+ "otherParkingType": "Garage and double width driveway"
26
+ },
27
+ "listingAndConservation": {
28
+ "isListed": {
29
+ "yesNo": "No"
30
+ },
31
+ "isConservationArea": {
32
+ "yesNo": "No"
33
+ },
34
+ "hasTreePreservationOrder": {
35
+ "yesNo": "No"
36
+ }
37
+ },
38
+ "typeOfConstruction": {
39
+ "isStandardForm": {
40
+ "yesNo": "Yes"
41
+ },
42
+ "hasFlammableExternalWallSystem": "No"
43
+ },
44
+ "councilTax": {
45
+ "councilTaxBand": "A",
46
+ "councilTaxAffectingAlterations": {
47
+ "yesNo": "No"
48
+ }
49
+ }
50
+ },
51
+ "disputesAndComplaints": {
52
+ "hasDisputesAndComplaints": {
53
+ "yesNo": "No"
54
+ }
55
+ },
56
+ "alterationsAndChanges": {
57
+ "hasStructuralAlterations": {
58
+ "buildingRegApproval": {
59
+ "yesNo": "Yes"
60
+ },
61
+ "planningPermission": {
62
+ "yesNo": "Yes"
63
+ },
64
+ "listedBuildingConsent": {
65
+ "yesNo": "Not required",
66
+ "reasons": "Not listed building\n"
67
+ },
68
+ "deedRestrictionConsent": {
69
+ "yesNo": "Not required",
70
+ "reasons": "Retrospective consent obtained from leasehold provider but property now freehold"
71
+ },
72
+ "unfinished": {
73
+ "yesNo": "No"
74
+ },
75
+ "yesNo": "Yes",
76
+ "details": "Bedroom and ensuite shower room extension 2005"
77
+ },
78
+ "windowReplacementsSince2002": {
79
+ "buildingRegApproval": {
80
+ "yesNo": "Not required",
81
+ "reasons": "Not required"
82
+ },
83
+ "planningPermission": {
84
+ "yesNo": "Not required",
85
+ "reasons": "Not required"
86
+ },
87
+ "listedBuildingConsent": {
88
+ "yesNo": "Not required",
89
+ "reasons": "Not listed building"
90
+ },
91
+ "deedRestrictionConsent": {
92
+ "yesNo": "Not required",
93
+ "reasons": "None required"
94
+ },
95
+ "unfinished": {
96
+ "yesNo": "No"
97
+ },
98
+ "yesNo": "Yes",
99
+ "details": "New front door added 2016"
100
+ },
101
+ "hasAddedConservatory": {
102
+ "buildingRegApproval": {
103
+ "yesNo": "Not required",
104
+ "reasons": "Added as part of initial build"
105
+ },
106
+ "planningPermission": {
107
+ "yesNo": "Not required",
108
+ "reasons": "Added as part of initial build"
109
+ },
110
+ "listedBuildingConsent": {
111
+ "yesNo": "Not required",
112
+ "reasons": "Not listed building"
113
+ },
114
+ "deedRestrictionConsent": {
115
+ "yesNo": "Not required",
116
+ "reasons": "Added as part of initial build and deeds"
117
+ },
118
+ "unfinished": {
119
+ "yesNo": "No"
120
+ },
121
+ "yesNo": "Yes",
122
+ "details": "Conservatory added during house build in 1990 and exterior quality door separates the conservatory from the kitchen/dining room"
123
+ },
124
+ "planningPermissionBreaches": {
125
+ "yesNo": "No"
126
+ },
127
+ "unresolvedPlanningIssues": {
128
+ "yesNo": "No"
129
+ }
130
+ },
131
+ "notices": {
132
+ "neighbourDevelopment": {
133
+ "yesNo": "No"
134
+ },
135
+ "planningApplication": {
136
+ "yesNo": "No"
137
+ },
138
+ "requiredMaintenance": {
139
+ "yesNo": "No"
140
+ },
141
+ "listedBuildingApplication": {
142
+ "yesNo": "No"
143
+ },
144
+ "infrastructureProject": {
145
+ "yesNo": "No"
146
+ },
147
+ "partyWallAct": {
148
+ "yesNo": "No"
149
+ },
150
+ "otherNotices": {
151
+ "yesNo": "No"
152
+ }
153
+ },
154
+ "specialistIssues": {
155
+ "dryRotEtcTreatment": {
156
+ "yesNo": "No"
157
+ },
158
+ "containsAsbestos": {
159
+ "yesNo": "No"
160
+ },
161
+ "japaneseKnotweed": {
162
+ "yesNo": "No"
163
+ },
164
+ "subsidenceOrStructuralFault": {
165
+ "yesNo": "No"
166
+ },
167
+ "ongoingHealthOrSafetyIssue": {
168
+ "yesNo": "No"
169
+ }
170
+ },
171
+ "fixturesAndFittings": {
172
+ "itemsToRemove": {
173
+ "yesNo": "No"
174
+ },
175
+ "itemsToInclude": {
176
+ "yesNo": "No"
177
+ }
178
+ },
179
+ "waterAndDrainage": {
180
+ "mainsWater": {
181
+ "maintenanceAgreements": {
182
+ "yesNo": "No"
183
+ },
184
+ "yesNo": "Yes",
185
+ "connected": "Yes",
186
+ "supplier": "Northumbria Water"
187
+ },
188
+ "mainsSurfaceWaterDrainage": {
189
+ "maintenanceAgreements": {
190
+ "yesNo": "No"
191
+ },
192
+ "yesNo": "Yes",
193
+ "connected": "Yes",
194
+ "supplier": "Northumbria Water"
195
+ },
196
+ "mainsFoulDrainage": {
197
+ "maintenanceAgreements": {
198
+ "yesNo": "No"
199
+ },
200
+ "yesNo": "Yes",
201
+ "connected": "Yes",
202
+ "supplier": "Northumbria Water"
203
+ }
204
+ },
205
+ "utilities": {
206
+ "electricity": {
207
+ "maintenanceAgreements": {
208
+ "yesNo": "No"
209
+ },
210
+ "yesNo": "Yes",
211
+ "connected": "Yes",
212
+ "supplier": "Octopus Energy"
213
+ },
214
+ "gas": {
215
+ "maintenanceAgreements": {
216
+ "yesNo": "No"
217
+ },
218
+ "yesNo": "Yes",
219
+ "connected": "Yes",
220
+ "supplier": "Octopus Energy"
221
+ },
222
+ "lpg": {
223
+ "yesNo": "No"
224
+ },
225
+ "oil": {
226
+ "yesNo": "No"
227
+ },
228
+ "telephone": {
229
+ "maintenanceAgreements": {
230
+ "yesNo": "No"
231
+ },
232
+ "yesNo": "Yes",
233
+ "connected": "Yes",
234
+ "supplier": "EE"
235
+ },
236
+ "cableSatelliteTV": {
237
+ "maintenanceAgreements": {
238
+ "yesNo": "No"
239
+ },
240
+ "yesNo": "Yes",
241
+ "connected": "Yes",
242
+ "supplier": "Sky"
243
+ },
244
+ "broadband": {
245
+ "maintenanceAgreements": {
246
+ "yesNo": "No"
247
+ },
248
+ "yesNo": "Yes",
249
+ "connected": "Yes",
250
+ "supplier": "EE"
251
+ },
252
+ "solarPanels": {
253
+ "yesNo": "No"
254
+ },
255
+ "otherServices": {
256
+ "yesNo": "No"
257
+ }
258
+ },
259
+ "greenDealLoan": {
260
+ "hasGreenDealLoan": {
261
+ "yesNo": "No"
262
+ }
263
+ },
264
+ "centralHeating": {
265
+ "hasCentralHeating": {
266
+ "boilerInstallationCertificate": {
267
+ "yesNo": "Yes",
268
+ "details": "Certified installation"
269
+ },
270
+ "heatingInGoodWorkingOrder": {
271
+ "yesNo": "Yes"
272
+ },
273
+ "yesNo": "Yes",
274
+ "centralHeatingFuel": "Gas boiler",
275
+ "centralHeatingInstalled": "2016-04-20",
276
+ "heatingServiceReport": "Full service history available from Whickham Plumbing & Heating ",
277
+ "heatingLastServiced": "2021-03-26"
278
+ }
279
+ },
280
+ "insurance": {
281
+ "difficultiesObtainingInsurance": {
282
+ "yesNo": "No"
283
+ },
284
+ "insuranceClaims": {
285
+ "yesNo": "No"
286
+ },
287
+ "isInsured": "Yes"
288
+ },
289
+ "boundaries": {
290
+ "partOutsideLegalOwnership": {
291
+ "yesNo": "No"
292
+ },
293
+ "partOnSeparateSiteOrDeed": {
294
+ "yesNo": "No"
295
+ },
296
+ "boundariesDifferFromTitlePlan": {
297
+ "yesNo": "No"
298
+ },
299
+ "boundaryAlterationProposal": {
300
+ "yesNo": "No"
301
+ }
302
+ },
303
+ "rightsAndInformalArrangements": {
304
+ "sharedContributions": {
305
+ "yesNo": "No"
306
+ },
307
+ "neighbouringLandRights": {
308
+ "yesNo": "No"
309
+ },
310
+ "accessRestrictionAttempts": {
311
+ "yesNo": "No"
312
+ },
313
+ "rightsOrArrangements": {
314
+ "publicRightOfWay": {
315
+ "yesNo": "No"
316
+ },
317
+ "rightsofLightOrSupport": {
318
+ "yesNo": "No"
319
+ },
320
+ "rightsCreatedThroughCustom": {
321
+ "yesNo": "No"
322
+ },
323
+ "minesAndMinerals": {
324
+ "yesNo": "No"
325
+ },
326
+ "churchChancel": {
327
+ "yesNo": "No"
328
+ },
329
+ "otherRights": {
330
+ "yesNo": "No"
331
+ }
332
+ }
333
+ },
334
+ "otherIssues": {
335
+ "environmental": {
336
+ "yesNo": "No"
337
+ },
338
+ "excessiveNoise": {
339
+ "yesNo": "No"
340
+ },
341
+ "crime": {
342
+ "yesNo": "No"
343
+ },
344
+ "cautionOrConviction": {
345
+ "yesNo": "No"
346
+ },
347
+ "failedTransactionsInLast12Months": {
348
+ "yesNo": "No"
349
+ },
350
+ "comments": "Not applicable"
351
+ },
352
+ "additionalInformation": {
353
+ "restrictionsOnUseNotCompliedWith": {
354
+ "yesNo": "No"
355
+ },
356
+ "otherMaterialIssue": {
357
+ "yesNo": "No"
358
+ }
359
+ },
360
+ "consumerProtectionRegulationsDeclaration": true
361
+ }
362
+ }
363
+ }
@@ -0,0 +1,44 @@
1
+ import jp from "jsonpointer";
2
+
3
+ import {
4
+ propertyPackSchema,
5
+ validator,
6
+ getSubschema,
7
+ getSubschemaValidator
8
+ } from "../index.js";
9
+ import examplePropertyPack from "./examplePropertyPack.json";
10
+
11
+ test("exports a property pack schema", () => {
12
+ expect(propertyPackSchema).not.toBeNull();
13
+ });
14
+
15
+ test("sample is valid", () => {
16
+ const isValid = validator(examplePropertyPack);
17
+ expect(isValid).toBe(true);
18
+ });
19
+
20
+ test("invalid sample is invalid", () => {
21
+ const clonedExamplePropertyPack = JSON.parse(
22
+ JSON.stringify(examplePropertyPack)
23
+ );
24
+ delete clonedExamplePropertyPack.propertyPack.materialFacts.notices;
25
+ const isValid = validator(clonedExamplePropertyPack);
26
+ expect(isValid).toBe(false);
27
+ });
28
+
29
+ test("correctly gets a subschema", () => {
30
+ const subschema = getSubschema("/propertyPack/materialFacts/notices");
31
+ expect(subschema.title).toBe("Notices which Affect the Property");
32
+ });
33
+
34
+ test("correctly gets a working subschema validator", () => {
35
+ const path = "/propertyPack/materialFacts/notices";
36
+ const validator = getSubschemaValidator(path);
37
+ const data = jp.get(examplePropertyPack, path);
38
+ expect(data.neighbourDevelopment.yesNo).toBe("No");
39
+ let isValid = validator(data);
40
+ expect(isValid).toBe(true);
41
+ data.neighbourDevelopment.yesNo = "Invalid string";
42
+ isValid = validator(data);
43
+ expect(isValid).toBe(false);
44
+ });