@pdtf/schemas 3.6.0-9 → 3.6.0-dev.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.
Files changed (191) hide show
  1. package/CLAUDE.md +101 -0
  2. package/README.md +57 -33
  3. package/docs/branch-release-workflow.md +138 -0
  4. package/docs/sef25-extensions-ui-spec.md +355 -0
  5. package/index.js +131 -75
  6. package/package.json +6 -2
  7. package/pensive-tesla-d0d355/CLAUDE.md +101 -0
  8. package/pensive-tesla-d0d355/LICENSE +21 -0
  9. package/pensive-tesla-d0d355/README.md +435 -0
  10. package/pensive-tesla-d0d355/docs/branch-release-workflow.md +138 -0
  11. package/pensive-tesla-d0d355/docs/sef25-extensions-ui-spec.md +355 -0
  12. package/pensive-tesla-d0d355/index.js +654 -0
  13. package/pensive-tesla-d0d355/package-lock.json +7297 -0
  14. package/pensive-tesla-d0d355/package.json +44 -0
  15. package/pensive-tesla-d0d355/src/examples/v1/exampleAddParticipantVouch.json +32 -0
  16. package/pensive-tesla-d0d355/src/examples/v1/exampleDocumentedVouch.json +40 -0
  17. package/pensive-tesla-d0d355/src/examples/v1/exampleElectronicRecord.json +30 -0
  18. package/pensive-tesla-d0d355/src/examples/v1/exampleTransaction.json +878 -0
  19. package/pensive-tesla-d0d355/src/examples/v1/exampleVouch.json +25 -0
  20. package/pensive-tesla-d0d355/src/examples/v2/exampleTransaction.json +901 -0
  21. package/pensive-tesla-d0d355/src/examples/v3/exampleAddParticipantVouch.json +38 -0
  22. package/pensive-tesla-d0d355/src/examples/v3/exampleCustomOverlay.json +55 -0
  23. package/pensive-tesla-d0d355/src/examples/v3/exampleCustomOverlay2.json +93 -0
  24. package/pensive-tesla-d0d355/src/examples/v3/exampleDocumentedVouch.json +47 -0
  25. package/pensive-tesla-d0d355/src/examples/v3/exampleElectronicRecord.json +36 -0
  26. package/pensive-tesla-d0d355/src/examples/v3/exampleTransaction.json +1038 -0
  27. package/pensive-tesla-d0d355/src/examples/v3/exampleVouch.json +32 -0
  28. package/pensive-tesla-d0d355/src/mappings/SendPropertyDetailsRequestSchema.json +1588 -0
  29. package/pensive-tesla-d0d355/src/mappings/adf.js +198 -0
  30. package/pensive-tesla-d0d355/src/schemas/v1/GeoJSON.json +1279 -0
  31. package/pensive-tesla-d0d355/src/schemas/v1/baspiNotes.html +102 -0
  32. package/pensive-tesla-d0d355/src/schemas/v1/energy-performance-certificate.json +124 -0
  33. package/pensive-tesla-d0d355/src/schemas/v1/freehold-information.json +2051 -0
  34. package/pensive-tesla-d0d355/src/schemas/v1/leasehold-information.json +2064 -0
  35. package/pensive-tesla-d0d355/src/schemas/v1/legal-information.json +1045 -0
  36. package/pensive-tesla-d0d355/src/schemas/v1/material-facts.json +2109 -0
  37. package/pensive-tesla-d0d355/src/schemas/v1/pdtf-transaction-search-results.json +40 -0
  38. package/pensive-tesla-d0d355/src/schemas/v1/pdtf-transaction.json +191 -0
  39. package/pensive-tesla-d0d355/src/schemas/v1/searches/drainage-and-water.json +261 -0
  40. package/pensive-tesla-d0d355/src/schemas/v1/searches/local-land-charges.json +69 -0
  41. package/pensive-tesla-d0d355/src/schemas/v1/searches/local-searches-required.json +857 -0
  42. package/pensive-tesla-d0d355/src/schemas/v1/searches.json +237 -0
  43. package/pensive-tesla-d0d355/src/schemas/v1/title-deed.json +841 -0
  44. package/pensive-tesla-d0d355/src/schemas/v2/baspiNotes.html +102 -0
  45. package/pensive-tesla-d0d355/src/schemas/v2/combined.json +37731 -0
  46. package/pensive-tesla-d0d355/src/schemas/v2/overlays/baspi.json +8132 -0
  47. package/pensive-tesla-d0d355/src/schemas/v2/overlays/con29DW.json +705 -0
  48. package/pensive-tesla-d0d355/src/schemas/v2/overlays/con29R.json +2956 -0
  49. package/pensive-tesla-d0d355/src/schemas/v2/overlays/fme1.json +1259 -0
  50. package/pensive-tesla-d0d355/src/schemas/v2/overlays/llc1.json +25 -0
  51. package/pensive-tesla-d0d355/src/schemas/v2/overlays/lpe1.json +2171 -0
  52. package/pensive-tesla-d0d355/src/schemas/v2/overlays/nts.json +326 -0
  53. package/pensive-tesla-d0d355/src/schemas/v2/overlays/oc1.json +2799 -0
  54. package/pensive-tesla-d0d355/src/schemas/v2/overlays/piq.json +3419 -0
  55. package/pensive-tesla-d0d355/src/schemas/v2/overlays/rds.json +3736 -0
  56. package/pensive-tesla-d0d355/src/schemas/v2/overlays/ta10.json +5306 -0
  57. package/pensive-tesla-d0d355/src/schemas/v2/overlays/ta6.json +4533 -0
  58. package/pensive-tesla-d0d355/src/schemas/v2/overlays/ta7.json +1045 -0
  59. package/pensive-tesla-d0d355/src/schemas/v2/pdtf-transaction.json +34351 -0
  60. package/pensive-tesla-d0d355/src/schemas/v2/skeleton.json +3973 -0
  61. package/pensive-tesla-d0d355/src/schemas/v3/combined.json +48469 -0
  62. package/pensive-tesla-d0d355/src/schemas/v3/compactSkeleton.txt +4519 -0
  63. package/pensive-tesla-d0d355/src/schemas/v3/overlays/README.md +299 -0
  64. package/pensive-tesla-d0d355/src/schemas/v3/overlays/baspi4.json +8025 -0
  65. package/pensive-tesla-d0d355/src/schemas/v3/overlays/baspi5.json +8175 -0
  66. package/pensive-tesla-d0d355/src/schemas/v3/overlays/con29DW.json +716 -0
  67. package/pensive-tesla-d0d355/src/schemas/v3/overlays/con29R.json +2981 -0
  68. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/ac.json +333 -0
  69. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/as.json +74 -0
  70. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/dk.json +32 -0
  71. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/dr.json +73 -0
  72. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/er.json +85 -0
  73. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/fd.json +75 -0
  74. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/hi.json +51 -0
  75. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/hs.json +73 -0
  76. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/ic.json +59 -0
  77. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/jk.json +96 -0
  78. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/la.json +85 -0
  79. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/lc.json +75 -0
  80. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/ma.json +90 -0
  81. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/mc.json +38 -0
  82. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/mi.json +69 -0
  83. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/nd.json +43 -0
  84. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/oa.json +24 -0
  85. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/oc.json +57 -0
  86. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/pc.json +37 -0
  87. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/ph.json +194 -0
  88. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/rw.json +68 -0
  89. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/sb.json +73 -0
  90. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/sc.json +129 -0
  91. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/sd.json +63 -0
  92. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/sf.json +74 -0
  93. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/sl.json +68 -0
  94. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/ta.json +252 -0
  95. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/tf.json +103 -0
  96. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/tr.json +73 -0
  97. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/wg.json +350 -0
  98. package/pensive-tesla-d0d355/src/schemas/v3/overlays/fme1.json +1266 -0
  99. package/pensive-tesla-d0d355/src/schemas/v3/overlays/llc1.json +25 -0
  100. package/pensive-tesla-d0d355/src/schemas/v3/overlays/lpe1.json +2199 -0
  101. package/pensive-tesla-d0d355/src/schemas/v3/overlays/nts.json +2157 -0
  102. package/pensive-tesla-d0d355/src/schemas/v3/overlays/nts2.json +2742 -0
  103. package/pensive-tesla-d0d355/src/schemas/v3/overlays/ntsl.json +1813 -0
  104. package/pensive-tesla-d0d355/src/schemas/v3/overlays/ntsl2.json +2217 -0
  105. package/pensive-tesla-d0d355/src/schemas/v3/overlays/oc1.json +2817 -0
  106. package/pensive-tesla-d0d355/src/schemas/v3/overlays/piq.json +3322 -0
  107. package/pensive-tesla-d0d355/src/schemas/v3/overlays/rds.json +3665 -0
  108. package/pensive-tesla-d0d355/src/schemas/v3/overlays/sef25.json +1639 -0
  109. package/pensive-tesla-d0d355/src/schemas/v3/overlays/sr24.json +38 -0
  110. package/pensive-tesla-d0d355/src/schemas/v3/overlays/ta10.json +4654 -0
  111. package/pensive-tesla-d0d355/src/schemas/v3/overlays/ta6.json +4568 -0
  112. package/pensive-tesla-d0d355/src/schemas/v3/overlays/ta6ed6.json +6534 -0
  113. package/pensive-tesla-d0d355/src/schemas/v3/overlays/ta7.json +1537 -0
  114. package/pensive-tesla-d0d355/src/schemas/v3/overlays/ta7ed5.json +1551 -0
  115. package/pensive-tesla-d0d355/src/schemas/v3/pdtf-transaction.json +41573 -0
  116. package/pensive-tesla-d0d355/src/schemas/v3/skeleton.json +5767 -0
  117. package/pensive-tesla-d0d355/src/schemas/verifiedClaims/README.md +21 -0
  118. package/pensive-tesla-d0d355/src/schemas/verifiedClaims/pdtf-verified-claims.json +447 -0
  119. package/pensive-tesla-d0d355/src/utils/compactSkeleton.js +84 -0
  120. package/pensive-tesla-d0d355/src/utils/countTokens.js +67 -0
  121. package/pensive-tesla-d0d355/src/utils/extractExtensionOverlays.js +624 -0
  122. package/pensive-tesla-d0d355/src/utils/extractOverlay.js +381 -0
  123. package/pensive-tesla-d0d355/src/utils/extractProperties.js +44 -0
  124. package/pensive-tesla-d0d355/src/utils/listPathTitles.js +36 -0
  125. package/pensive-tesla-d0d355/src/utils/minimalSkeleton.js +85 -0
  126. package/pensive-tesla-d0d355/src/utils/pathList.csv +903 -0
  127. package/pensive-tesla-d0d355/src/utils/pathSkeleton.js +181 -0
  128. package/src/examples/v3/exampleTransaction.json +3 -3
  129. package/src/schemas/v3/combined.json +8047 -1982
  130. package/src/schemas/v3/compactSkeleton.txt +379 -5
  131. package/src/schemas/v3/overlays/baspi4.json +164 -21
  132. package/src/schemas/v3/overlays/baspi5.json +169 -23
  133. package/src/schemas/v3/overlays/extensions/ac.json +333 -0
  134. package/src/schemas/v3/overlays/extensions/as.json +4 -2
  135. package/src/schemas/v3/overlays/extensions/dk.json +32 -0
  136. package/src/schemas/v3/overlays/extensions/dr.json +9 -9
  137. package/src/schemas/v3/overlays/extensions/er.json +4 -2
  138. package/src/schemas/v3/overlays/extensions/fd.json +6 -3
  139. package/src/schemas/v3/overlays/extensions/hi.json +6 -3
  140. package/src/schemas/v3/overlays/extensions/hs.json +4 -2
  141. package/src/schemas/v3/overlays/extensions/ic.json +59 -0
  142. package/src/schemas/v3/overlays/extensions/jk.json +28 -8
  143. package/src/schemas/v3/overlays/extensions/la.json +4 -2
  144. package/src/schemas/v3/overlays/extensions/lc.json +75 -0
  145. package/src/schemas/v3/overlays/extensions/ma.json +6 -3
  146. package/src/schemas/v3/overlays/extensions/mc.json +4 -2
  147. package/src/schemas/v3/overlays/extensions/mi.json +69 -0
  148. package/src/schemas/v3/overlays/extensions/nd.json +43 -0
  149. package/src/schemas/v3/overlays/extensions/oa.json +4 -2
  150. package/src/schemas/v3/overlays/extensions/oc.json +4 -2
  151. package/src/schemas/v3/overlays/extensions/pc.json +37 -0
  152. package/src/schemas/v3/overlays/extensions/ph.json +194 -0
  153. package/src/schemas/v3/overlays/extensions/rw.json +68 -0
  154. package/src/schemas/v3/overlays/extensions/sb.json +4 -2
  155. package/src/schemas/v3/overlays/extensions/sc.json +129 -0
  156. package/src/schemas/v3/overlays/extensions/sd.json +63 -0
  157. package/src/schemas/v3/overlays/extensions/sf.json +4 -2
  158. package/src/schemas/v3/overlays/extensions/sl.json +4 -2
  159. package/src/schemas/v3/overlays/extensions/ta.json +204 -0
  160. package/src/schemas/v3/overlays/extensions/tf.json +6 -3
  161. package/src/schemas/v3/overlays/extensions/tr.json +73 -0
  162. package/src/schemas/v3/overlays/extensions/wg.json +350 -0
  163. package/src/schemas/v3/overlays/fme1.json +16 -14
  164. package/src/schemas/v3/overlays/lpe1.json +60 -30
  165. package/src/schemas/v3/overlays/nts.json +68 -1
  166. package/src/schemas/v3/overlays/nts2.json +68 -4
  167. package/src/schemas/v3/overlays/ntsl.json +68 -1
  168. package/src/schemas/v3/overlays/ntsl2.json +68 -4
  169. package/src/schemas/v3/overlays/piq.json +39 -4
  170. package/src/schemas/v3/overlays/rds.json +117 -8
  171. package/src/schemas/v3/overlays/sef25.json +1639 -0
  172. package/src/schemas/v3/overlays/ta6.json +46 -16
  173. package/src/schemas/v3/overlays/ta6ed6.json +6534 -0
  174. package/src/schemas/v3/overlays/ta7.json +70 -6
  175. package/src/schemas/v3/overlays/ta7ed5.json +1551 -0
  176. package/src/schemas/v3/pdtf-transaction.json +4565 -1021
  177. package/src/schemas/v3/skeleton.json +510 -38
  178. package/src/utils/extractExtensionOverlays.js +293 -31
  179. package/src/utils/extractOverlay.js +94 -27
  180. package/src/utils/pathSkeleton.js +1 -1
  181. package/.claude/settings.local.json +0 -42
  182. package/.github/workflows/pages.yml +0 -50
  183. package/CNAME +0 -1
  184. package/_config.yml +0 -1
  185. package/src/tests/v3/caching.test.js +0 -591
  186. package/src/tests/v3/enquiries.test.js +0 -1096
  187. package/src/tests/v3/extensionOverlays.test.js +0 -525
  188. package/src/tests/v3/offers.test.js +0 -823
  189. package/src/tests/v3/patternProperties.test.js +0 -688
  190. package/src/tests/v3/transactionSchema.test.js +0 -615
  191. package/src/tests/v3/verifiedClaimsValidator.test.js +0 -195
@@ -1,195 +0,0 @@
1
- const { validateVerifiedClaims } = require("../../../index.js");
2
-
3
- const exampleVouch = require("../../examples/v3/exampleVouch.json");
4
- const exampleDocumentedVouch = require("../../examples/v3/exampleDocumentedVouch.json");
5
- const v3SchemaId =
6
- "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json";
7
-
8
- test("returns an empty array for a valid claim", () => {
9
- expect(validateVerifiedClaims([exampleVouch])).toEqual([]);
10
- });
11
-
12
- test("returns an empty array for a valid array of claims", () => {
13
- const claimsArray = [exampleVouch, exampleDocumentedVouch];
14
- expect(validateVerifiedClaims(claimsArray)).toEqual([]);
15
- });
16
-
17
- test("returns an array with an error stating if path is incorrect", () => {
18
- const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
19
- const originalPath = Object.keys(clonedVouch.claims)[0];
20
- const data = clonedVouch.claims[originalPath];
21
- clonedVouch.claims = {
22
- "/propertyPack/INVALID/councilTax": data,
23
- };
24
- // v3 schema, no overlay
25
- expect(validateVerifiedClaims([clonedVouch], v3SchemaId, null)).toEqual([
26
- "Path /propertyPack/INVALID/councilTax is not a valid PDTF schema path",
27
- ]);
28
- });
29
-
30
- test("returns errors if BASPI requirements are not met and BASPI overlay is specified", () => {
31
- const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
32
- clonedVouch.claims = {
33
- "/propertyPack/delayFactors": {
34
- hasDelayFactors: { yesNo: "Yes" },
35
- },
36
- };
37
- const errors = validateVerifiedClaims([clonedVouch], v3SchemaId, ["baspiV4"]);
38
- expect(errors).toEqual([
39
- {
40
- instancePath: "/hasDelayFactors",
41
- schemaPath: "#/properties/hasDelayFactors/oneOf/1/required",
42
- keyword: "required",
43
- params: { missingProperty: "details" },
44
- message: "must have required property 'details'",
45
- },
46
- {
47
- instancePath: "/hasDelayFactors",
48
- schemaPath: "#/properties/hasDelayFactors/oneOf/1/required",
49
- keyword: "required",
50
- params: { missingProperty: "attachments" },
51
- message: "must have required property 'attachments'",
52
- },
53
- ]);
54
- });
55
-
56
- test("returns no errors if BASPI requirements are not met and null overlay is specified", () => {
57
- const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
58
- clonedVouch.claims = {
59
- "/propertyPack/delayFactors": {
60
- hasDelayFactors: { yesNo: "Yes" },
61
- },
62
- };
63
- const errors = validateVerifiedClaims([clonedVouch], v3SchemaId, null);
64
- expect(errors).toEqual([]);
65
- });
66
-
67
- test("returns errors for invalid fields even if null overlay is specified", () => {
68
- const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
69
- clonedVouch.claims = {
70
- "/propertyPack/delayFactors": {
71
- hasDelayFactors: { yesNo: "Maybe" },
72
- },
73
- };
74
- const errors = validateVerifiedClaims([clonedVouch], v3SchemaId, null);
75
- expect(errors).toHaveLength(4);
76
- });
77
-
78
- test("returns an array of errors for verified claim with multiple paths", () => {
79
- const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
80
- clonedVouch.claims = {
81
- "/propertyPack/cousncilTaxBad": {
82
- councilTaxBand: "D",
83
- councilTaxAffectingAlterations: {
84
- yesNo: "Yes",
85
- details:
86
- "Extension added in 2005 to add bedroom with ensuite shower room. Certificate of Compliance issued 17th Feb 2006 and council tax updated",
87
- },
88
- },
89
- "/propertyPack/councilTaxBadTwo": {
90
- councilTaxBand: "D",
91
- councilTaxAffectingAlterations: {
92
- yesNo: "Yes",
93
- details:
94
- "Extension added in 2005 to add bedroom with ensuite shower room. Certificate of Compliance issued 17th Feb 2006 and council tax updated",
95
- },
96
- },
97
- };
98
- expect(validateVerifiedClaims([clonedVouch], v3SchemaId, null)).toEqual([
99
- "Path /propertyPack/cousncilTaxBad is not a valid PDTF schema path",
100
- "Path /propertyPack/councilTaxBadTwo is not a valid PDTF schema path",
101
- ]);
102
- });
103
-
104
- test("returns an empty array of errors for verified claim with multiple valid paths", () => {
105
- const clonedVouch = JSON.parse(
106
- JSON.stringify(exampleVouch),
107
- v3SchemaId,
108
- null
109
- );
110
- clonedVouch.claims = {
111
- "/propertyPack/councilTax": {
112
- councilTaxBand: "D",
113
- councilTaxAffectingAlterations: {
114
- yesNo: "Yes",
115
- details:
116
- "Extension added in 2005 to add bedroom with ensuite shower room. Certificate of Compliance issued 17th Feb 2006 and council tax updated",
117
- },
118
- },
119
- "/propertyPack/address": {
120
- line1: "property.line1",
121
- line2: "property.line2",
122
- town: "property.city",
123
- county: "property.province",
124
- postcode: "property.postcode",
125
- },
126
- };
127
- expect(validateVerifiedClaims([clonedVouch], v3SchemaId, null)).toEqual([]);
128
- });
129
-
130
- test("returns an empty array for valid terms_of_use object with confidential level", () => {
131
- const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
132
- clonedVouch.terms_of_use = {
133
- confidentiality_level: "confidential",
134
- allowed_roles: ["Seller's Conveyancer", "Buyer's Conveyancer"]
135
- };
136
- expect(validateVerifiedClaims([clonedVouch])).toEqual([]);
137
- });
138
-
139
- test("returns an empty array for valid terms_of_use with public confidentiality", () => {
140
- const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
141
- clonedVouch.terms_of_use = {
142
- confidentiality_level: "public",
143
- allowed_roles: []
144
- };
145
- expect(validateVerifiedClaims([clonedVouch])).toEqual([]);
146
- });
147
-
148
- test("returns an empty array for valid terms_of_use with restricted level", () => {
149
- const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
150
- clonedVouch.terms_of_use = {
151
- confidentiality_level: "restricted",
152
- allowed_roles: []
153
- };
154
- expect(validateVerifiedClaims([clonedVouch])).toEqual([]);
155
- });
156
-
157
- test("returns errors for invalid confidentiality_level in terms_of_use", () => {
158
- const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
159
- clonedVouch.terms_of_use = {
160
- confidentiality_level: "invalid_level",
161
- allowed_roles: ["Seller's Conveyancer"]
162
- };
163
- const errors = validateVerifiedClaims([clonedVouch]);
164
- expect(errors).toHaveLength(1);
165
- expect(errors[0]).toHaveLength(1);
166
- expect(errors[0][0].instancePath).toBe("/verified_claims/0/terms_of_use/confidentiality_level");
167
- expect(errors[0][0].keyword).toBe("enum");
168
- });
169
-
170
- test("returns errors for invalid allowed_roles type in terms_of_use", () => {
171
- const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
172
- clonedVouch.terms_of_use = {
173
- confidentiality_level: "confidential",
174
- allowed_roles: "not_an_array"
175
- };
176
- const errors = validateVerifiedClaims([clonedVouch]);
177
- expect(errors).toHaveLength(1);
178
- expect(errors[0]).toHaveLength(1);
179
- expect(errors[0][0].instancePath).toBe("/verified_claims/0/terms_of_use/allowed_roles");
180
- expect(errors[0][0].keyword).toBe("type");
181
- });
182
-
183
- test("returns errors for additional properties in terms_of_use", () => {
184
- const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
185
- clonedVouch.terms_of_use = {
186
- confidentiality_level: "confidential",
187
- allowed_roles: ["Estate Agent"],
188
- extra_property: "should_not_be_allowed"
189
- };
190
- const errors = validateVerifiedClaims([clonedVouch]);
191
- expect(errors).toHaveLength(1);
192
- expect(errors[0]).toHaveLength(1);
193
- expect(errors[0][0].instancePath).toBe("/verified_claims/0/terms_of_use");
194
- expect(errors[0][0].keyword).toBe("additionalProperties");
195
- });