@transitrix/diagrams 1.8.4 → 1.8.7

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 (254) hide show
  1. package/dist/edge-path.js +10 -1
  2. package/dist/webview/render-activities.d.ts +1 -1
  3. package/dist/webview/render-activities.js +2 -2
  4. package/dist/webview/render-fgca.js +1 -4
  5. package/package.json +7 -2
  6. package/src/edge-path.ts +15 -1
  7. package/src/webview/render-activities.ts +2 -2
  8. package/src/webview/render-fgca.ts +1 -4
  9. package/dist/__tests__/edge-path.test.d.ts +0 -1
  10. package/dist/__tests__/edge-path.test.js +0 -47
  11. package/dist/__tests__/node-size-presets.test.d.ts +0 -1
  12. package/dist/__tests__/node-size-presets.test.js +0 -30
  13. package/dist/__tests__/scope.test.d.ts +0 -1
  14. package/dist/__tests__/scope.test.js +0 -23
  15. package/dist/__tests__/yaml-normalize.test.d.ts +0 -1
  16. package/dist/__tests__/yaml-normalize.test.js +0 -148
  17. package/dist/activities/__tests__/cpm.test.d.ts +0 -1
  18. package/dist/activities/__tests__/cpm.test.js +0 -146
  19. package/dist/activities/__tests__/gantt.test.d.ts +0 -1
  20. package/dist/activities/__tests__/gantt.test.js +0 -263
  21. package/dist/activities/__tests__/layout.test.d.ts +0 -1
  22. package/dist/activities/__tests__/layout.test.js +0 -98
  23. package/dist/activities/__tests__/validate.test.d.ts +0 -1
  24. package/dist/activities/__tests__/validate.test.js +0 -397
  25. package/dist/activity-card/__tests__/example.test.d.ts +0 -1
  26. package/dist/activity-card/__tests__/example.test.js +0 -73
  27. package/dist/activity-card/__tests__/layout.test.d.ts +0 -1
  28. package/dist/activity-card/__tests__/layout.test.js +0 -141
  29. package/dist/activity-card/__tests__/resolver.test.d.ts +0 -1
  30. package/dist/activity-card/__tests__/resolver.test.js +0 -325
  31. package/dist/activity-card/__tests__/validate.test.d.ts +0 -1
  32. package/dist/activity-card/__tests__/validate.test.js +0 -149
  33. package/dist/actor/__tests__/validate.test.d.ts +0 -1
  34. package/dist/actor/__tests__/validate.test.js +0 -95
  35. package/dist/applications/__tests__/validate.test.d.ts +0 -1
  36. package/dist/applications/__tests__/validate.test.js +0 -223
  37. package/dist/assertion/__tests__/example.test.d.ts +0 -1
  38. package/dist/assertion/__tests__/example.test.js +0 -32
  39. package/dist/assertion/__tests__/validate.test.d.ts +0 -1
  40. package/dist/assertion/__tests__/validate.test.js +0 -130
  41. package/dist/blocks/__tests__/layout.test.d.ts +0 -1
  42. package/dist/blocks/__tests__/layout.test.js +0 -153
  43. package/dist/blocks/__tests__/validate.test.d.ts +0 -1
  44. package/dist/blocks/__tests__/validate.test.js +0 -235
  45. package/dist/business-service/__tests__/validate.test.d.ts +0 -1
  46. package/dist/business-service/__tests__/validate.test.js +0 -135
  47. package/dist/capability-map/__tests__/CapabilityMapView.test.d.ts +0 -1
  48. package/dist/capability-map/__tests__/CapabilityMapView.test.js +0 -217
  49. package/dist/capability-map/__tests__/address.test.d.ts +0 -1
  50. package/dist/capability-map/__tests__/address.test.js +0 -49
  51. package/dist/capability-map/__tests__/dsm-layout.test.d.ts +0 -1
  52. package/dist/capability-map/__tests__/dsm-layout.test.js +0 -46
  53. package/dist/capability-map/__tests__/dsm-mutations.test.d.ts +0 -1
  54. package/dist/capability-map/__tests__/dsm-mutations.test.js +0 -125
  55. package/dist/capability-map/__tests__/dsm-validate.test.d.ts +0 -1
  56. package/dist/capability-map/__tests__/dsm-validate.test.js +0 -56
  57. package/dist/capability-map/__tests__/validate.test.d.ts +0 -1
  58. package/dist/capability-map/__tests__/validate.test.js +0 -212
  59. package/dist/change/__tests__/validate.test.d.ts +0 -1
  60. package/dist/change/__tests__/validate.test.js +0 -79
  61. package/dist/codex/__tests__/example.test.d.ts +0 -1
  62. package/dist/codex/__tests__/example.test.js +0 -33
  63. package/dist/codex/__tests__/validate.test.d.ts +0 -1
  64. package/dist/codex/__tests__/validate.test.js +0 -68
  65. package/dist/compliance/__tests__/canon-catalog.test.d.ts +0 -1
  66. package/dist/compliance/__tests__/canon-catalog.test.js +0 -60
  67. package/dist/compliance/__tests__/classify.test.d.ts +0 -1
  68. package/dist/compliance/__tests__/classify.test.js +0 -58
  69. package/dist/compliance/__tests__/confidence.test.d.ts +0 -1
  70. package/dist/compliance/__tests__/confidence.test.js +0 -78
  71. package/dist/compliance/__tests__/coverage-metric.test.d.ts +0 -1
  72. package/dist/compliance/__tests__/coverage-metric.test.js +0 -264
  73. package/dist/compliance/__tests__/demo-scenario.test.d.ts +0 -1
  74. package/dist/compliance/__tests__/demo-scenario.test.js +0 -226
  75. package/dist/compliance/__tests__/example.test.d.ts +0 -1
  76. package/dist/compliance/__tests__/example.test.js +0 -51
  77. package/dist/compliance/__tests__/gap-report.test.d.ts +0 -1
  78. package/dist/compliance/__tests__/gap-report.test.js +0 -113
  79. package/dist/compliance/__tests__/html.test.d.ts +0 -1
  80. package/dist/compliance/__tests__/html.test.js +0 -122
  81. package/dist/compliance/__tests__/impact.test.d.ts +0 -1
  82. package/dist/compliance/__tests__/impact.test.js +0 -913
  83. package/dist/compliance/__tests__/markdown.test.d.ts +0 -1
  84. package/dist/compliance/__tests__/markdown.test.js +0 -85
  85. package/dist/compliance/__tests__/trace.test.d.ts +0 -1
  86. package/dist/compliance/__tests__/trace.test.js +0 -144
  87. package/dist/compliance/__tests__/view-resolution.test.d.ts +0 -1
  88. package/dist/compliance/__tests__/view-resolution.test.js +0 -59
  89. package/dist/compliance/__tests__/views.test.d.ts +0 -1
  90. package/dist/compliance/__tests__/views.test.js +0 -59
  91. package/dist/compliance-matrix/__tests__/build.test.d.ts +0 -1
  92. package/dist/compliance-matrix/__tests__/build.test.js +0 -183
  93. package/dist/compliance-matrix/__tests__/example.test.d.ts +0 -1
  94. package/dist/compliance-matrix/__tests__/example.test.js +0 -49
  95. package/dist/confidence/__tests__/score.test.d.ts +0 -1
  96. package/dist/confidence/__tests__/score.test.js +0 -188
  97. package/dist/constraint/__tests__/example.test.d.ts +0 -1
  98. package/dist/constraint/__tests__/example.test.js +0 -14
  99. package/dist/constraint/__tests__/validate.test.d.ts +0 -1
  100. package/dist/constraint/__tests__/validate.test.js +0 -58
  101. package/dist/factor/__tests__/validate.test.d.ts +0 -1
  102. package/dist/factor/__tests__/validate.test.js +0 -112
  103. package/dist/fgca/__tests__/chain-table.test.d.ts +0 -1
  104. package/dist/fgca/__tests__/chain-table.test.js +0 -158
  105. package/dist/fgca/__tests__/layout.test.d.ts +0 -1
  106. package/dist/fgca/__tests__/layout.test.js +0 -140
  107. package/dist/fgca/__tests__/parse-canonical.test.d.ts +0 -1
  108. package/dist/fgca/__tests__/parse-canonical.test.js +0 -268
  109. package/dist/fgca/__tests__/preview-layout.test.d.ts +0 -1
  110. package/dist/fgca/__tests__/preview-layout.test.js +0 -106
  111. package/dist/fgca/__tests__/resolver.test.d.ts +0 -1
  112. package/dist/fgca/__tests__/resolver.test.js +0 -185
  113. package/dist/fgca/__tests__/validate.test.d.ts +0 -1
  114. package/dist/fgca/__tests__/validate.test.js +0 -125
  115. package/dist/goals/__tests__/GoalTreeView.test.d.ts +0 -1
  116. package/dist/goals/__tests__/GoalTreeView.test.js +0 -337
  117. package/dist/goals/__tests__/layout.test.d.ts +0 -1
  118. package/dist/goals/__tests__/layout.test.js +0 -153
  119. package/dist/goals/__tests__/mutations.test.d.ts +0 -1
  120. package/dist/goals/__tests__/mutations.test.js +0 -134
  121. package/dist/goals/__tests__/parse-canonical.test.d.ts +0 -1
  122. package/dist/goals/__tests__/parse-canonical.test.js +0 -131
  123. package/dist/goals/__tests__/validate.test.d.ts +0 -1
  124. package/dist/goals/__tests__/validate.test.js +0 -183
  125. package/dist/integration/__tests__/validate.test.d.ts +0 -1
  126. package/dist/integration/__tests__/validate.test.js +0 -169
  127. package/dist/location/__tests__/validate.test.d.ts +0 -1
  128. package/dist/location/__tests__/validate.test.js +0 -107
  129. package/dist/node/__tests__/validate.test.d.ts +0 -1
  130. package/dist/node/__tests__/validate.test.js +0 -100
  131. package/dist/process-blueprint/__tests__/compliance-lane.test.d.ts +0 -1
  132. package/dist/process-blueprint/__tests__/compliance-lane.test.js +0 -272
  133. package/dist/process-blueprint/__tests__/layout.test.d.ts +0 -1
  134. package/dist/process-blueprint/__tests__/layout.test.js +0 -196
  135. package/dist/process-blueprint/__tests__/validate.test.d.ts +0 -1
  136. package/dist/process-blueprint/__tests__/validate.test.js +0 -280
  137. package/dist/process-map/__tests__/validate.test.d.ts +0 -1
  138. package/dist/process-map/__tests__/validate.test.js +0 -199
  139. package/dist/products/__tests__/validate.test.d.ts +0 -1
  140. package/dist/products/__tests__/validate.test.js +0 -210
  141. package/dist/repo-validate/__tests__/validate-repo.test.d.ts +0 -1
  142. package/dist/repo-validate/__tests__/validate-repo.test.js +0 -576
  143. package/dist/requirement/__tests__/example.test.d.ts +0 -1
  144. package/dist/requirement/__tests__/example.test.js +0 -21
  145. package/dist/requirement/__tests__/validate.test.d.ts +0 -1
  146. package/dist/requirement/__tests__/validate.test.js +0 -80
  147. package/dist/scenarios/__tests__/validate.test.d.ts +0 -1
  148. package/dist/scenarios/__tests__/validate.test.js +0 -183
  149. package/dist/stakeholder/__tests__/validate.test.d.ts +0 -1
  150. package/dist/stakeholder/__tests__/validate.test.js +0 -88
  151. package/dist/target-state/__tests__/validate.test.d.ts +0 -1
  152. package/dist/target-state/__tests__/validate.test.js +0 -78
  153. package/dist/technology-service/__tests__/validate.test.d.ts +0 -1
  154. package/dist/technology-service/__tests__/validate.test.js +0 -121
  155. package/dist/theme/__tests__/tokens.test.d.ts +0 -1
  156. package/dist/theme/__tests__/tokens.test.js +0 -159
  157. package/dist/webview/__tests__/entity-text-layout.test.d.ts +0 -1
  158. package/dist/webview/__tests__/entity-text-layout.test.js +0 -155
  159. package/dist/webview/__tests__/entry-notations.test.d.ts +0 -1
  160. package/dist/webview/__tests__/entry-notations.test.js +0 -62
  161. package/dist/webview/__tests__/entry.test.d.ts +0 -1
  162. package/dist/webview/__tests__/entry.test.js +0 -56
  163. package/dist/webview/__tests__/render-activities.test.d.ts +0 -1
  164. package/dist/webview/__tests__/render-activities.test.js +0 -91
  165. package/dist/webview/__tests__/render-blocks.test.d.ts +0 -1
  166. package/dist/webview/__tests__/render-blocks.test.js +0 -175
  167. package/dist/webview/__tests__/render-goals.test.d.ts +0 -1
  168. package/dist/webview/__tests__/render-goals.test.js +0 -120
  169. package/dist/webview/__tests__/render-process.test.d.ts +0 -1
  170. package/dist/webview/__tests__/render-process.test.js +0 -463
  171. package/dist/webview/__tests__/render-util.test.d.ts +0 -1
  172. package/dist/webview/__tests__/render-util.test.js +0 -54
  173. package/src/__tests__/edge-path.test.ts +0 -58
  174. package/src/__tests__/node-size-presets.test.ts +0 -50
  175. package/src/__tests__/scope.test.ts +0 -27
  176. package/src/__tests__/yaml-normalize.test.ts +0 -158
  177. package/src/activities/__tests__/cpm.test.ts +0 -164
  178. package/src/activities/__tests__/gantt.test.ts +0 -290
  179. package/src/activities/__tests__/layout.test.ts +0 -112
  180. package/src/activities/__tests__/validate.test.ts +0 -446
  181. package/src/activity-card/__tests__/example.test.ts +0 -83
  182. package/src/activity-card/__tests__/layout.test.ts +0 -162
  183. package/src/activity-card/__tests__/resolver.test.ts +0 -357
  184. package/src/activity-card/__tests__/validate.test.ts +0 -167
  185. package/src/actor/__tests__/validate.test.ts +0 -114
  186. package/src/applications/__tests__/validate.test.ts +0 -256
  187. package/src/assertion/__tests__/example.test.ts +0 -37
  188. package/src/assertion/__tests__/validate.test.ts +0 -142
  189. package/src/blocks/__tests__/layout.test.ts +0 -169
  190. package/src/blocks/__tests__/validate.test.ts +0 -260
  191. package/src/business-service/__tests__/validate.test.ts +0 -160
  192. package/src/capability-map/__tests__/CapabilityMapView.test.tsx +0 -232
  193. package/src/capability-map/__tests__/address.test.ts +0 -59
  194. package/src/capability-map/__tests__/dsm-layout.test.ts +0 -52
  195. package/src/capability-map/__tests__/dsm-mutations.test.ts +0 -141
  196. package/src/capability-map/__tests__/dsm-validate.test.ts +0 -65
  197. package/src/capability-map/__tests__/validate.test.ts +0 -238
  198. package/src/change/__tests__/validate.test.ts +0 -97
  199. package/src/codex/__tests__/example.test.ts +0 -40
  200. package/src/codex/__tests__/validate.test.ts +0 -84
  201. package/src/compliance/__tests__/canon-catalog.test.ts +0 -68
  202. package/src/compliance/__tests__/classify.test.ts +0 -64
  203. package/src/compliance/__tests__/confidence.test.ts +0 -98
  204. package/src/compliance/__tests__/coverage-metric.test.ts +0 -300
  205. package/src/compliance/__tests__/demo-scenario.test.ts +0 -273
  206. package/src/compliance/__tests__/example.test.ts +0 -57
  207. package/src/compliance/__tests__/gap-report.test.ts +0 -129
  208. package/src/compliance/__tests__/html.test.ts +0 -142
  209. package/src/compliance/__tests__/impact.test.ts +0 -1060
  210. package/src/compliance/__tests__/markdown.test.ts +0 -95
  211. package/src/compliance/__tests__/trace.test.ts +0 -157
  212. package/src/compliance/__tests__/view-resolution.test.ts +0 -80
  213. package/src/compliance/__tests__/views.test.ts +0 -64
  214. package/src/compliance-matrix/__tests__/build.test.ts +0 -200
  215. package/src/compliance-matrix/__tests__/example.test.ts +0 -57
  216. package/src/confidence/__tests__/score.test.ts +0 -254
  217. package/src/constraint/__tests__/example.test.ts +0 -19
  218. package/src/constraint/__tests__/validate.test.ts +0 -68
  219. package/src/factor/__tests__/validate.test.ts +0 -133
  220. package/src/fgca/__tests__/chain-table.test.ts +0 -172
  221. package/src/fgca/__tests__/layout.test.ts +0 -179
  222. package/src/fgca/__tests__/parse-canonical.test.ts +0 -296
  223. package/src/fgca/__tests__/preview-layout.test.ts +0 -124
  224. package/src/fgca/__tests__/resolver.test.ts +0 -209
  225. package/src/fgca/__tests__/validate.test.ts +0 -142
  226. package/src/goals/__tests__/GoalTreeView.test.tsx +0 -361
  227. package/src/goals/__tests__/layout.test.ts +0 -175
  228. package/src/goals/__tests__/mutations.test.ts +0 -153
  229. package/src/goals/__tests__/parse-canonical.test.ts +0 -147
  230. package/src/goals/__tests__/validate.test.ts +0 -202
  231. package/src/integration/__tests__/validate.test.ts +0 -203
  232. package/src/location/__tests__/validate.test.ts +0 -127
  233. package/src/node/__tests__/validate.test.ts +0 -118
  234. package/src/process-blueprint/__tests__/compliance-lane.test.ts +0 -320
  235. package/src/process-blueprint/__tests__/layout.test.ts +0 -240
  236. package/src/process-blueprint/__tests__/validate.test.ts +0 -310
  237. package/src/process-map/__tests__/validate.test.ts +0 -223
  238. package/src/products/__tests__/validate.test.ts +0 -239
  239. package/src/repo-validate/__tests__/validate-repo.test.ts +0 -699
  240. package/src/requirement/__tests__/example.test.ts +0 -24
  241. package/src/requirement/__tests__/validate.test.ts +0 -96
  242. package/src/scenarios/__tests__/validate.test.ts +0 -209
  243. package/src/stakeholder/__tests__/validate.test.ts +0 -105
  244. package/src/target-state/__tests__/validate.test.ts +0 -95
  245. package/src/technology-service/__tests__/validate.test.ts +0 -143
  246. package/src/theme/__tests__/tokens.test.ts +0 -185
  247. package/src/webview/__tests__/entity-text-layout.test.ts +0 -182
  248. package/src/webview/__tests__/entry-notations.test.ts +0 -77
  249. package/src/webview/__tests__/entry.test.ts +0 -64
  250. package/src/webview/__tests__/render-activities.test.ts +0 -100
  251. package/src/webview/__tests__/render-blocks.test.ts +0 -206
  252. package/src/webview/__tests__/render-goals.test.ts +0 -128
  253. package/src/webview/__tests__/render-process.test.ts +0 -538
  254. package/src/webview/__tests__/render-util.test.ts +0 -66
@@ -1,114 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { validateActor } from '../validate.js';
3
-
4
- function valid(): Record<string, unknown> {
5
- return {
6
- notation: 'actor',
7
- id: 'ACTOR-OPS-1',
8
- name: 'Operations',
9
- type: 'business_unit',
10
- description: 'The operations organisation.',
11
- contact: 'ops@acme.example',
12
- zone: 'canon',
13
- admitted_at: '2026-05-29',
14
- admitted_by: 'v.korobeinikov',
15
- gate_checks: { uniqueness: 'pass', consistency: 'pass', completeness: 'pass' },
16
- valid_from: '2024-01-01',
17
- valid_to: null,
18
- };
19
- }
20
-
21
- const codes = (input: unknown): string[] =>
22
- validateActor(input).errors.map(e => e.code);
23
-
24
- describe('validateActor — positive', () => {
25
- it('accepts a well-formed business_unit actor', () => {
26
- const r = validateActor(valid());
27
- expect(r.valid, JSON.stringify(r.errors)).toBe(true);
28
- });
29
-
30
- it('accepts a person actor with no optional fields', () => {
31
- const a = valid();
32
- a.id = 'ACTOR-JANE-DOE-1';
33
- a.name = 'Jane Doe';
34
- a.type = 'person';
35
- delete a.description;
36
- delete a.contact;
37
- expect(validateActor(a).valid).toBe(true);
38
- });
39
-
40
- it('accepts a system actor with external_ref', () => {
41
- const a = valid();
42
- a.id = 'ACTOR-ORDER-MGMT-SYS-1';
43
- a.name = 'Order Management System';
44
- a.type = 'system';
45
- a.external_ref = 'https://oms.acme.example/api';
46
- expect(validateActor(a).valid).toBe(true);
47
- });
48
- });
49
-
50
- describe('validateActor — ACTOR-001 (shape / id grammar)', () => {
51
- it('flags a missing required envelope field', () => {
52
- const a = valid();
53
- delete a.name;
54
- expect(codes(a)).toContain('ACTOR-001');
55
- });
56
-
57
- it('flags an id that violates the grammar', () => {
58
- expect(codes({ ...valid(), id: 'ACTOR-OPS-001' })).toContain('ACTOR-001');
59
- expect(codes({ ...valid(), id: 'A-1' })).toContain('ACTOR-001');
60
- });
61
-
62
- it('flags a wrong notation tag and non-canon zone', () => {
63
- expect(codes({ ...valid(), notation: 'business_actor' })).toContain('ACTOR-001');
64
- expect(codes({ ...valid(), zone: 'sandbox' })).toContain('ACTOR-001');
65
- });
66
-
67
- it('flags a missing type', () => {
68
- const a = valid();
69
- delete a.type;
70
- expect(codes(a)).toContain('ACTOR-001');
71
- });
72
-
73
- it('flags a missing valid_to key', () => {
74
- const a = valid();
75
- delete a.valid_to;
76
- expect(codes(a)).toContain('ACTOR-001');
77
- });
78
-
79
- it('rejects a non-object', () => {
80
- expect(codes(null)).toEqual(['ACTOR-001']);
81
- });
82
- });
83
-
84
- describe('validateActor — ACTOR-002 (type enum)', () => {
85
- it('flags a type outside {person, business_unit, system}', () => {
86
- expect(codes({ ...valid(), type: 'organisation' })).toContain('ACTOR-002');
87
- });
88
- });
89
-
90
- describe('validateActor — ACTOR-003 (engagement fields forbidden inline)', () => {
91
- it('flags inline employment', () => {
92
- expect(codes({ ...valid(), employment: 'REL-EMP-1' })).toContain('ACTOR-003');
93
- });
94
-
95
- it('flags inline unit_parent', () => {
96
- expect(codes({ ...valid(), unit_parent: 'ACTOR-PARENT-1' })).toContain('ACTOR-003');
97
- });
98
-
99
- it('flags inline roles', () => {
100
- expect(codes({ ...valid(), roles: ['ROLE-OPS-1'] })).toContain('ACTOR-003');
101
- });
102
-
103
- it('flags inline owner', () => {
104
- expect(codes({ ...valid(), owner: 'ACTOR-OPS-1' })).toContain('ACTOR-003');
105
- });
106
-
107
- it('flags inline located_at (location belongs in a REL file)', () => {
108
- expect(codes({ ...valid(), located_at: 'LOCATION-TBILISI-1' })).toContain('ACTOR-003');
109
- });
110
-
111
- it('flags inline unit_located_at (location belongs in a REL file)', () => {
112
- expect(codes({ ...valid(), unit_located_at: 'LOCATION-TBILISI-1' })).toContain('ACTOR-003');
113
- });
114
- });
@@ -1,256 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { validateApplicationsCatalogue } from '../validate.js';
3
-
4
- const VALID_CATALOGUE = {
5
- notation: 'applications',
6
- applications_catalogue: {
7
- id: 'APP-CAT-001',
8
- name: 'Enterprise Applications',
9
- updated_at: '2026-05-14',
10
- applications: [
11
- { app_id: 'APP-001', name: 'Order System', type: 'application', status: 'Active', maturity: 3 },
12
- { app_id: 'INT-001', name: 'Event Bus', type: 'integration', status: 'Draft' },
13
- ],
14
- },
15
- };
16
-
17
- describe('validateApplicationsCatalogue', () => {
18
- it('passes on valid input', () => {
19
- const r = validateApplicationsCatalogue(VALID_CATALOGUE);
20
- expect(r.valid).toBe(true);
21
- expect(r.errors).toHaveLength(0);
22
- });
23
-
24
- it('APP-001: rejects non-object input', () => {
25
- expect(validateApplicationsCatalogue(null).valid).toBe(false);
26
- expect(validateApplicationsCatalogue(null).errors[0].code).toBe('APP-001');
27
- });
28
-
29
- it('APP-001: rejects missing notation', () => {
30
- const { notation: _, ...rest } = VALID_CATALOGUE;
31
- const r = validateApplicationsCatalogue(rest);
32
- expect(r.errors.some(e => e.code === 'APP-001')).toBe(true);
33
- });
34
-
35
- it('APP-001: rejects wrong notation value', () => {
36
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, notation: 'products' });
37
- expect(r.errors.some(e => e.code === 'APP-001')).toBe(true);
38
- });
39
-
40
- it('APP-002: rejects missing applications_catalogue', () => {
41
- const r = validateApplicationsCatalogue({ notation: 'applications' });
42
- expect(r.errors.some(e => e.code === 'APP-002')).toBe(true);
43
- });
44
-
45
- it('APP-002: rejects missing id', () => {
46
- const cat = { ...VALID_CATALOGUE.applications_catalogue, id: '' };
47
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
48
- expect(r.errors.some(e => e.code === 'APP-002' && e.message.includes('id'))).toBe(true);
49
- });
50
-
51
- it('APP-002: rejects missing name', () => {
52
- const cat = { ...VALID_CATALOGUE.applications_catalogue, name: ' ' };
53
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
54
- expect(r.errors.some(e => e.code === 'APP-002' && e.message.includes('name'))).toBe(true);
55
- });
56
-
57
- it('APP-002: rejects missing updated_at', () => {
58
- const { updated_at: _, ...cat } = VALID_CATALOGUE.applications_catalogue;
59
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
60
- expect(r.errors.some(e => e.code === 'APP-002' && e.message.includes('updated_at'))).toBe(true);
61
- });
62
-
63
- it('APP-002: rejects non-array applications', () => {
64
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: 'bad' };
65
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
66
- expect(r.errors.some(e => e.code === 'APP-002')).toBe(true);
67
- });
68
-
69
- it('APP-003: rejects missing app_id', () => {
70
- const apps = [{ name: 'X', type: 'application', status: 'Active' }];
71
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
72
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
73
- expect(r.errors.some(e => e.code === 'APP-003' && e.message.includes('app_id'))).toBe(true);
74
- });
75
-
76
- it('APP-003: rejects missing name', () => {
77
- const apps = [{ app_id: 'A1', name: '', type: 'application', status: 'Active' }];
78
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
79
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
80
- expect(r.errors.some(e => e.code === 'APP-003' && e.message.includes('name'))).toBe(true);
81
- });
82
-
83
- it('APP-003: rejects missing type', () => {
84
- const apps = [{ app_id: 'A1', name: 'X', status: 'Active' }];
85
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
86
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
87
- expect(r.errors.some(e => e.code === 'APP-003' && e.message.includes('type'))).toBe(true);
88
- });
89
-
90
- it('APP-003: rejects missing status', () => {
91
- const apps = [{ app_id: 'A1', name: 'X', type: 'application' }];
92
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
93
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
94
- expect(r.errors.some(e => e.code === 'APP-003' && e.message.includes('status'))).toBe(true);
95
- });
96
-
97
- it('APP-004: rejects invalid type', () => {
98
- const apps = [{ app_id: 'A1', name: 'X', type: 'hardware', status: 'Active' }];
99
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
100
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
101
- expect(r.errors.some(e => e.code === 'APP-004')).toBe(true);
102
- });
103
-
104
- it('APP-004: accepts all valid types', () => {
105
- for (const type of ['application', 'integration', 'platform', 'data_store']) {
106
- const apps = [{ app_id: 'A1', name: 'X', type, status: 'Active' }];
107
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
108
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
109
- expect(r.errors.some(e => e.code === 'APP-004')).toBe(false);
110
- }
111
- });
112
-
113
- it('APP-005: rejects invalid status', () => {
114
- const apps = [{ app_id: 'A1', name: 'X', type: 'application', status: 'Unknown' }];
115
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
116
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
117
- expect(r.errors.some(e => e.code === 'APP-005')).toBe(true);
118
- });
119
-
120
- it('APP-005: accepts all four valid statuses', () => {
121
- for (const status of ['Draft', 'Active', 'Deprecated', 'Decommissioning']) {
122
- const apps = [{ app_id: 'A1', name: 'X', type: 'application', status }];
123
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
124
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
125
- expect(r.errors.some(e => e.code === 'APP-005')).toBe(false);
126
- }
127
- });
128
-
129
- it('APP-006: rejects maturity < 1', () => {
130
- const apps = [{ app_id: 'A1', name: 'X', type: 'application', status: 'Active', maturity: 0 }];
131
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
132
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
133
- expect(r.errors.some(e => e.code === 'APP-006')).toBe(true);
134
- });
135
-
136
- it('APP-006: rejects maturity > 5', () => {
137
- const apps = [{ app_id: 'A1', name: 'X', type: 'application', status: 'Active', maturity: 6 }];
138
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
139
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
140
- expect(r.errors.some(e => e.code === 'APP-006')).toBe(true);
141
- });
142
-
143
- it('APP-006: rejects non-integer maturity', () => {
144
- const apps = [{ app_id: 'A1', name: 'X', type: 'application', status: 'Active', maturity: 3.5 }];
145
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
146
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
147
- expect(r.errors.some(e => e.code === 'APP-006')).toBe(true);
148
- });
149
-
150
- it('APP-006: accepts valid maturity range 1-5', () => {
151
- for (const maturity of [1, 2, 3, 4, 5]) {
152
- const apps = [{ app_id: 'A1', name: 'X', type: 'application', status: 'Active', maturity }];
153
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
154
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
155
- expect(r.errors.some(e => e.code === 'APP-006')).toBe(false);
156
- }
157
- });
158
-
159
- it('APP-007: rejects malformed updated_at', () => {
160
- const cat = { ...VALID_CATALOGUE.applications_catalogue, updated_at: '14/05/2026' };
161
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
162
- expect(r.errors.some(e => e.code === 'APP-007')).toBe(true);
163
- });
164
-
165
- it('APP-007: accepts YYYY-MM-DD format', () => {
166
- const cat = { ...VALID_CATALOGUE.applications_catalogue, updated_at: '2026-01-01' };
167
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
168
- expect(r.errors.some(e => e.code === 'APP-007')).toBe(false);
169
- });
170
-
171
- it('APP-008: rejects duplicate app_id', () => {
172
- const apps = [
173
- { app_id: 'A1', name: 'X', type: 'application', status: 'Active' },
174
- { app_id: 'A1', name: 'Y', type: 'platform', status: 'Draft' },
175
- ];
176
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
177
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
178
- expect(r.errors.some(e => e.code === 'APP-008')).toBe(true);
179
- });
180
-
181
- it('APP-009: rejects invalid integration direction', () => {
182
- const apps = [{
183
- app_id: 'A1', name: 'X', type: 'application', status: 'Active',
184
- integrations: [{ target: 'A2', direction: 'sideways' }],
185
- }];
186
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
187
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
188
- expect(r.errors.some(e => e.code === 'APP-009')).toBe(true);
189
- });
190
-
191
- it('APP-009: accepts valid integration directions', () => {
192
- for (const direction of ['inbound', 'outbound', 'bidirectional']) {
193
- const apps = [{
194
- app_id: 'A1', name: 'X', type: 'application', status: 'Active',
195
- integrations: [{ target: 'A2', direction }],
196
- }];
197
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
198
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
199
- expect(r.errors.some(e => e.code === 'APP-009')).toBe(false);
200
- }
201
- });
202
-
203
- it('APP-009: accepts integration without direction', () => {
204
- const apps = [{
205
- app_id: 'A1', name: 'X', type: 'application', status: 'Active',
206
- integrations: [{ target: 'A2', protocol: 'REST' }],
207
- }];
208
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
209
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
210
- expect(r.valid).toBe(true);
211
- });
212
-
213
- it('accepts empty applications array', () => {
214
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: [] };
215
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
216
- expect(r.valid).toBe(true);
217
- });
218
-
219
- it('accepts application with all optional fields', () => {
220
- const apps = [{
221
- app_id: 'A1', name: 'Full App', type: 'application', status: 'Active',
222
- domain: 'Sales', owner_role: 'ROLE-001', vendor: 'Salesforce', maturity: 4,
223
- description: 'CRM system', capabilities: ['CAP-001'], products: ['PROD-001'],
224
- integrations: [{ target: 'A2', direction: 'outbound', protocol: 'REST', description: 'sends events' }],
225
- }];
226
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
227
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
228
- expect(r.valid).toBe(true);
229
- });
230
-
231
- // Pre-release blocker regression (orchestrator review 2026-05-21).
232
- it('[blocker] tolerates a null element in applications[] without throwing', () => {
233
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: [null] };
234
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
235
- expect(r.valid).toBe(false);
236
- expect(r.errors.some(e => e.code === 'APP-003')).toBe(true);
237
- });
238
-
239
- it('[blocker] tolerates a string element in applications[] without throwing', () => {
240
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: ['x'] };
241
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
242
- expect(r.valid).toBe(false);
243
- expect(r.errors.some(e => e.code === 'APP-003')).toBe(true);
244
- });
245
-
246
- it('[blocker] tolerates a null integration entry without throwing', () => {
247
- const apps = [{
248
- app_id: 'A1', name: 'X', type: 'application', status: 'Active',
249
- integrations: [null],
250
- }];
251
- const cat = { ...VALID_CATALOGUE.applications_catalogue, applications: apps };
252
- const r = validateApplicationsCatalogue({ ...VALID_CATALOGUE, applications_catalogue: cat });
253
- expect(r.valid).toBe(false);
254
- expect(r.errors.some(e => e.code === 'APP-009')).toBe(true);
255
- });
256
- });
@@ -1,37 +0,0 @@
1
- // Conformance test for the shipped ASSERTION worked examples — the acme_corp
2
- // canon files mirrored under `tests/fixtures/notation-corpus/assertion/`. Pins the success signal of
3
- // vkgeorgia/strategy#84 Phase 1: the library consumes the canonical example
4
- // files without error.
5
-
6
- import { describe, it, expect } from 'vitest';
7
- import { readFileSync } from 'node:fs';
8
- import { fileURLToPath } from 'node:url';
9
- import path from 'node:path';
10
- import yaml from 'js-yaml';
11
- import { validateAssertion } from '../validate.js';
12
-
13
- const dir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../../tests/fixtures/notation-corpus/assertion');
14
- const load = (f: string): unknown => yaml.load(readFileSync(path.join(dir, f), 'utf-8'));
15
-
16
- // Fixed reference date so the ASSERT-008 staleness check is deterministic; all
17
- // three examples have a future review date relative to it.
18
- const today = '2026-06-02';
19
-
20
- describe('assertion worked examples (acme_corp)', () => {
21
- for (const f of [
22
- 'ASSERTION-MOBILE-DATA-ERASURE-1.yaml',
23
- 'ASSERTION-CRM-DATA-ERASURE-1.yaml',
24
- 'ASSERTION-ONBOARD-DATA-ERASURE-1.yaml',
25
- ]) {
26
- it(`validates ${f} without error`, () => {
27
- const v = validateAssertion(load(f), { today });
28
- expect(v.valid, JSON.stringify(v.errors)).toBe(true);
29
- expect(v.errors).toHaveLength(0);
30
- });
31
- }
32
-
33
- it('does not raise ASSERT-007 for the under_review assertion with empty evidence', () => {
34
- const v = validateAssertion(load('ASSERTION-CRM-DATA-ERASURE-1.yaml'), { today });
35
- expect(v.warnings.map(w => w.code)).not.toContain('ASSERT-007');
36
- });
37
- });
@@ -1,142 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { validateAssertion } from '../validate.js';
3
- import type { CanonCatalog } from '../../typed-id.js';
4
-
5
- function valid(): Record<string, unknown> {
6
- return {
7
- notation: 'assertion',
8
- id: 'ASSERTION-MOBILE-DATA-ERASURE-1',
9
- about: 'REQUIREMENT-DATA-ERASURE-1',
10
- subject: 'PRODUCT-MOBILE-1',
11
- realised_via: ['CAPABILITY-V2', 'PROCESS-USER-DATA-PURGE-1'],
12
- status: 'compliant',
13
- evidence: [{ kind: 'note', text: 'DPO review confirmed compliance.' }],
14
- assessed_at: '2026-03-15',
15
- next_review_at: '2026-09-15',
16
- zone: 'canon',
17
- admitted_at: '2026-05-28',
18
- admitted_by: 'v.korobeinikov',
19
- gate_checks: { uniqueness: 'pass' },
20
- valid_from: '2026-03-15',
21
- valid_to: null,
22
- };
23
- }
24
-
25
- const codes = (input: unknown, opts?: Parameters<typeof validateAssertion>[1]): string[] =>
26
- validateAssertion(input, opts).errors.map(e => e.code);
27
- const warnCodes = (input: unknown, opts?: Parameters<typeof validateAssertion>[1]): string[] =>
28
- validateAssertion(input, opts).warnings.map(w => w.code);
29
-
30
- describe('validateAssertion — positive', () => {
31
- it('accepts a well-formed assertion', () => {
32
- const r = validateAssertion(valid());
33
- expect(r.valid, JSON.stringify(r.errors)).toBe(true);
34
- expect(r.errors).toHaveLength(0);
35
- });
36
- });
37
-
38
- describe('validateAssertion — ASSERT-001 (shape / id grammar)', () => {
39
- it('flags id grammar, wrong notation, missing admission/lifecycle fields', () => {
40
- expect(codes({ ...valid(), id: 'ASSERT-1' })).toContain('ASSERT-001');
41
- expect(codes({ ...valid(), notation: 'claim' })).toContain('ASSERT-001');
42
- const noAdmit = valid(); delete noAdmit.admitted_at;
43
- expect(codes(noAdmit)).toContain('ASSERT-001');
44
- const noValidTo = valid(); delete noValidTo.valid_to;
45
- expect(codes(noValidTo)).toContain('ASSERT-001');
46
- });
47
-
48
- it('flags a missing status as ASSERT-001 (required field)', () => {
49
- const r = valid(); delete r.status;
50
- expect(codes(r)).toContain('ASSERT-001');
51
- });
52
-
53
- it('rejects a non-object', () => {
54
- expect(codes(null)).toEqual(['ASSERT-001']);
55
- });
56
- });
57
-
58
- describe('validateAssertion — ASSERT-002 (about → REQUIREMENT)', () => {
59
- it('flags a missing about', () => {
60
- const r = valid(); delete r.about;
61
- expect(codes(r)).toContain('ASSERT-002');
62
- });
63
- it('flags an about that is not a REQUIREMENT typed id', () => {
64
- expect(codes({ ...valid(), about: 'PRODUCT-MOBILE-1' })).toContain('ASSERT-002');
65
- });
66
- it('with a catalog, flags an unresolved about and a wrong-type about', () => {
67
- expect(codes({ ...valid() }, { catalog: { typeOf: () => undefined } })).toContain('ASSERT-002');
68
- const catalog: CanonCatalog = { typeOf: (id) => (id === 'REQUIREMENT-DATA-ERASURE-1' ? 'GOAL' : 'PRODUCT') };
69
- expect(codes(valid(), { catalog })).toContain('ASSERT-002');
70
- });
71
- });
72
-
73
- describe('validateAssertion — ASSERT-003 (subject TYPE)', () => {
74
- it('flags a subject whose TYPE is not PRODUCT/PROCESS/CAPABILITY', () => {
75
- expect(codes({ ...valid(), subject: 'GOAL-1' })).toContain('ASSERT-003');
76
- });
77
- it('accepts PRODUCT, PROCESS and CAPABILITY subjects', () => {
78
- for (const s of ['PRODUCT-1', 'PROCESS-1', 'CAPABILITY-V2']) {
79
- expect(codes({ ...valid(), subject: s })).not.toContain('ASSERT-003');
80
- }
81
- });
82
- it('with a catalog, flags an unresolved subject', () => {
83
- const catalog: CanonCatalog = { typeOf: (id) => (id === 'PRODUCT-MOBILE-1' ? undefined : 'REQUIREMENT') };
84
- expect(codes(valid(), { catalog })).toContain('ASSERT-003');
85
- });
86
- });
87
-
88
- describe('validateAssertion — ASSERT-004 (realised_via resolves)', () => {
89
- it('flags a malformed realised_via entry', () => {
90
- expect(codes({ ...valid(), realised_via: ['nope'] })).toContain('ASSERT-004');
91
- });
92
- it('with a catalog, flags an unresolved realised_via entry', () => {
93
- const catalog: CanonCatalog = { typeOf: (id) => (id.startsWith('CAPABILITY') ? undefined : 'X') };
94
- expect(codes(valid(), { catalog })).toContain('ASSERT-004');
95
- });
96
- });
97
-
98
- describe('validateAssertion — ASSERT-005 (canonical_ref evidence resolves)', () => {
99
- it('flags a malformed canonical_ref', () => {
100
- expect(codes({ ...valid(), evidence: [{ kind: 'canonical_ref', ref: 'nope' }] })).toContain('ASSERT-005');
101
- });
102
- it('with a catalog, flags an unresolved canonical_ref', () => {
103
- const catalog: CanonCatalog = { typeOf: () => undefined };
104
- expect(codes({ ...valid(), evidence: [{ kind: 'canonical_ref', ref: 'PROCESS-X-1' }] }, { catalog })).toContain('ASSERT-005');
105
- });
106
- it('ignores external_doc and note evidence kinds for resolution', () => {
107
- const ev = [{ kind: 'external_doc', title: 't', url: 'u' }, { kind: 'note', text: 'n' }];
108
- expect(codes({ ...valid(), evidence: ev })).not.toContain('ASSERT-005');
109
- });
110
- });
111
-
112
- describe('validateAssertion — ASSERT-006 (status enum)', () => {
113
- it('flags an out-of-enum status', () => {
114
- expect(codes({ ...valid(), status: 'maybe' })).toContain('ASSERT-006');
115
- });
116
- it('accepts every status value', () => {
117
- for (const s of ['compliant', 'partial', 'non_compliant', 'under_review', 'n_a']) {
118
- expect(codes({ ...valid(), status: s, evidence: [{ kind: 'note', text: 'x' }] })).not.toContain('ASSERT-006');
119
- }
120
- });
121
- });
122
-
123
- describe('validateAssertion — ASSERT-007 (positive status without evidence)', () => {
124
- it('warns when evidence is empty and status is compliant or partial', () => {
125
- expect(warnCodes({ ...valid(), evidence: [], status: 'compliant' })).toContain('ASSERT-007');
126
- expect(warnCodes({ ...valid(), evidence: [], status: 'partial' })).toContain('ASSERT-007');
127
- });
128
- it('does not warn for under_review / non_compliant / n_a with empty evidence', () => {
129
- for (const s of ['under_review', 'non_compliant', 'n_a']) {
130
- expect(warnCodes({ ...valid(), evidence: [], status: s })).not.toContain('ASSERT-007');
131
- }
132
- });
133
- });
134
-
135
- describe('validateAssertion — ASSERT-008 (stale review)', () => {
136
- it('warns only when today is supplied and next_review_at is in the past', () => {
137
- expect(warnCodes({ ...valid(), next_review_at: '2026-01-01' }, { today: '2026-06-02' })).toContain('ASSERT-008');
138
- expect(warnCodes({ ...valid(), next_review_at: '2026-12-01' }, { today: '2026-06-02' })).not.toContain('ASSERT-008');
139
- // No `today` → clock-free, never warns.
140
- expect(warnCodes({ ...valid(), next_review_at: '2000-01-01' })).not.toContain('ASSERT-008');
141
- });
142
- });