@pdtf/schemas 3.4.0-1 → 3.4.0-3

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.
@@ -4145,4 +4145,4 @@
4145
4145
  "sellingAgent": {}
4146
4146
  }
4147
4147
  }
4148
- }
4148
+ }
@@ -44,6 +44,42 @@ test("sample is valid NTS", () => {
44
44
  expect(isValid).toBe(true);
45
45
  });
46
46
 
47
+ test("sample is not valid nts2025 out of the box", () => {
48
+ const validator = getValidator(schemaId, ["nts2025"]);
49
+ const isValid = validator(exampleTransaction);
50
+ expect(isValid).toBe(false);
51
+ expect(validator.errors.length).toBe(3);
52
+ expect(validator.errors.map((e) => e.message)).toEqual([
53
+ "must have required property 'transferFees'",
54
+ "must have required property 'constructionType'",
55
+ "must have required property 'floodDefences'",
56
+ ]);
57
+ });
58
+
59
+ test("sample is valid nts2025 with some additions", () => {
60
+ const validator = getValidator(schemaId, ["nts2025"]);
61
+ const clonedExampleTransaction = JSON.parse(
62
+ JSON.stringify(exampleTransaction)
63
+ );
64
+ clonedExampleTransaction.propertyPack.ownership.ownershipsToBeTransferred[0].leaseholdInformation.serviceCharge.transferFees =
65
+ {
66
+ yesNo: "Yes",
67
+ details: "Transfer fees exist",
68
+ };
69
+ clonedExampleTransaction.propertyPack.typeOfConstruction.isStandardForm = {
70
+ yesNo: "Yes",
71
+ constructionType: "Timber frame",
72
+ };
73
+ clonedExampleTransaction.propertyPack.environmentalIssues.flooding.floodDefences =
74
+ {
75
+ hasFloodDefences: "Yes",
76
+ details: "Flood defences exist",
77
+ };
78
+
79
+ const isValid = validator(clonedExampleTransaction);
80
+ expect(isValid).toBe(true);
81
+ });
82
+
47
83
  test("sample is not valid NTSL (lettings)", () => {
48
84
  const validator = getValidator(schemaId, ["ntsl2023"]);
49
85
  const isValid = validator(exampleTransaction);