@transitrix/diagrams 1.8.6 → 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 (247) hide show
  1. package/package.json +7 -2
  2. package/dist/__tests__/edge-path.test.d.ts +0 -1
  3. package/dist/__tests__/edge-path.test.js +0 -55
  4. package/dist/__tests__/node-size-presets.test.d.ts +0 -1
  5. package/dist/__tests__/node-size-presets.test.js +0 -30
  6. package/dist/__tests__/scope.test.d.ts +0 -1
  7. package/dist/__tests__/scope.test.js +0 -23
  8. package/dist/__tests__/yaml-normalize.test.d.ts +0 -1
  9. package/dist/__tests__/yaml-normalize.test.js +0 -148
  10. package/dist/activities/__tests__/cpm.test.d.ts +0 -1
  11. package/dist/activities/__tests__/cpm.test.js +0 -146
  12. package/dist/activities/__tests__/gantt.test.d.ts +0 -1
  13. package/dist/activities/__tests__/gantt.test.js +0 -263
  14. package/dist/activities/__tests__/layout.test.d.ts +0 -1
  15. package/dist/activities/__tests__/layout.test.js +0 -98
  16. package/dist/activities/__tests__/validate.test.d.ts +0 -1
  17. package/dist/activities/__tests__/validate.test.js +0 -397
  18. package/dist/activity-card/__tests__/example.test.d.ts +0 -1
  19. package/dist/activity-card/__tests__/example.test.js +0 -73
  20. package/dist/activity-card/__tests__/layout.test.d.ts +0 -1
  21. package/dist/activity-card/__tests__/layout.test.js +0 -141
  22. package/dist/activity-card/__tests__/resolver.test.d.ts +0 -1
  23. package/dist/activity-card/__tests__/resolver.test.js +0 -325
  24. package/dist/activity-card/__tests__/validate.test.d.ts +0 -1
  25. package/dist/activity-card/__tests__/validate.test.js +0 -149
  26. package/dist/actor/__tests__/validate.test.d.ts +0 -1
  27. package/dist/actor/__tests__/validate.test.js +0 -95
  28. package/dist/applications/__tests__/validate.test.d.ts +0 -1
  29. package/dist/applications/__tests__/validate.test.js +0 -223
  30. package/dist/assertion/__tests__/example.test.d.ts +0 -1
  31. package/dist/assertion/__tests__/example.test.js +0 -32
  32. package/dist/assertion/__tests__/validate.test.d.ts +0 -1
  33. package/dist/assertion/__tests__/validate.test.js +0 -130
  34. package/dist/blocks/__tests__/layout.test.d.ts +0 -1
  35. package/dist/blocks/__tests__/layout.test.js +0 -153
  36. package/dist/blocks/__tests__/validate.test.d.ts +0 -1
  37. package/dist/blocks/__tests__/validate.test.js +0 -235
  38. package/dist/business-service/__tests__/validate.test.d.ts +0 -1
  39. package/dist/business-service/__tests__/validate.test.js +0 -135
  40. package/dist/capability-map/__tests__/CapabilityMapView.test.d.ts +0 -1
  41. package/dist/capability-map/__tests__/CapabilityMapView.test.js +0 -217
  42. package/dist/capability-map/__tests__/address.test.d.ts +0 -1
  43. package/dist/capability-map/__tests__/address.test.js +0 -49
  44. package/dist/capability-map/__tests__/dsm-layout.test.d.ts +0 -1
  45. package/dist/capability-map/__tests__/dsm-layout.test.js +0 -46
  46. package/dist/capability-map/__tests__/dsm-mutations.test.d.ts +0 -1
  47. package/dist/capability-map/__tests__/dsm-mutations.test.js +0 -125
  48. package/dist/capability-map/__tests__/dsm-validate.test.d.ts +0 -1
  49. package/dist/capability-map/__tests__/dsm-validate.test.js +0 -56
  50. package/dist/capability-map/__tests__/validate.test.d.ts +0 -1
  51. package/dist/capability-map/__tests__/validate.test.js +0 -212
  52. package/dist/change/__tests__/validate.test.d.ts +0 -1
  53. package/dist/change/__tests__/validate.test.js +0 -79
  54. package/dist/codex/__tests__/example.test.d.ts +0 -1
  55. package/dist/codex/__tests__/example.test.js +0 -33
  56. package/dist/codex/__tests__/validate.test.d.ts +0 -1
  57. package/dist/codex/__tests__/validate.test.js +0 -68
  58. package/dist/compliance/__tests__/canon-catalog.test.d.ts +0 -1
  59. package/dist/compliance/__tests__/canon-catalog.test.js +0 -60
  60. package/dist/compliance/__tests__/classify.test.d.ts +0 -1
  61. package/dist/compliance/__tests__/classify.test.js +0 -58
  62. package/dist/compliance/__tests__/confidence.test.d.ts +0 -1
  63. package/dist/compliance/__tests__/confidence.test.js +0 -78
  64. package/dist/compliance/__tests__/coverage-metric.test.d.ts +0 -1
  65. package/dist/compliance/__tests__/coverage-metric.test.js +0 -264
  66. package/dist/compliance/__tests__/demo-scenario.test.d.ts +0 -1
  67. package/dist/compliance/__tests__/demo-scenario.test.js +0 -226
  68. package/dist/compliance/__tests__/example.test.d.ts +0 -1
  69. package/dist/compliance/__tests__/example.test.js +0 -51
  70. package/dist/compliance/__tests__/gap-report.test.d.ts +0 -1
  71. package/dist/compliance/__tests__/gap-report.test.js +0 -113
  72. package/dist/compliance/__tests__/html.test.d.ts +0 -1
  73. package/dist/compliance/__tests__/html.test.js +0 -122
  74. package/dist/compliance/__tests__/impact.test.d.ts +0 -1
  75. package/dist/compliance/__tests__/impact.test.js +0 -913
  76. package/dist/compliance/__tests__/markdown.test.d.ts +0 -1
  77. package/dist/compliance/__tests__/markdown.test.js +0 -85
  78. package/dist/compliance/__tests__/trace.test.d.ts +0 -1
  79. package/dist/compliance/__tests__/trace.test.js +0 -144
  80. package/dist/compliance/__tests__/view-resolution.test.d.ts +0 -1
  81. package/dist/compliance/__tests__/view-resolution.test.js +0 -59
  82. package/dist/compliance/__tests__/views.test.d.ts +0 -1
  83. package/dist/compliance/__tests__/views.test.js +0 -59
  84. package/dist/compliance-matrix/__tests__/build.test.d.ts +0 -1
  85. package/dist/compliance-matrix/__tests__/build.test.js +0 -183
  86. package/dist/compliance-matrix/__tests__/example.test.d.ts +0 -1
  87. package/dist/compliance-matrix/__tests__/example.test.js +0 -49
  88. package/dist/confidence/__tests__/score.test.d.ts +0 -1
  89. package/dist/confidence/__tests__/score.test.js +0 -188
  90. package/dist/constraint/__tests__/example.test.d.ts +0 -1
  91. package/dist/constraint/__tests__/example.test.js +0 -14
  92. package/dist/constraint/__tests__/validate.test.d.ts +0 -1
  93. package/dist/constraint/__tests__/validate.test.js +0 -58
  94. package/dist/factor/__tests__/validate.test.d.ts +0 -1
  95. package/dist/factor/__tests__/validate.test.js +0 -112
  96. package/dist/fgca/__tests__/chain-table.test.d.ts +0 -1
  97. package/dist/fgca/__tests__/chain-table.test.js +0 -158
  98. package/dist/fgca/__tests__/layout.test.d.ts +0 -1
  99. package/dist/fgca/__tests__/layout.test.js +0 -140
  100. package/dist/fgca/__tests__/parse-canonical.test.d.ts +0 -1
  101. package/dist/fgca/__tests__/parse-canonical.test.js +0 -268
  102. package/dist/fgca/__tests__/preview-layout.test.d.ts +0 -1
  103. package/dist/fgca/__tests__/preview-layout.test.js +0 -106
  104. package/dist/fgca/__tests__/resolver.test.d.ts +0 -1
  105. package/dist/fgca/__tests__/resolver.test.js +0 -185
  106. package/dist/fgca/__tests__/validate.test.d.ts +0 -1
  107. package/dist/fgca/__tests__/validate.test.js +0 -125
  108. package/dist/goals/__tests__/GoalTreeView.test.d.ts +0 -1
  109. package/dist/goals/__tests__/GoalTreeView.test.js +0 -337
  110. package/dist/goals/__tests__/layout.test.d.ts +0 -1
  111. package/dist/goals/__tests__/layout.test.js +0 -153
  112. package/dist/goals/__tests__/mutations.test.d.ts +0 -1
  113. package/dist/goals/__tests__/mutations.test.js +0 -134
  114. package/dist/goals/__tests__/parse-canonical.test.d.ts +0 -1
  115. package/dist/goals/__tests__/parse-canonical.test.js +0 -131
  116. package/dist/goals/__tests__/validate.test.d.ts +0 -1
  117. package/dist/goals/__tests__/validate.test.js +0 -183
  118. package/dist/integration/__tests__/validate.test.d.ts +0 -1
  119. package/dist/integration/__tests__/validate.test.js +0 -169
  120. package/dist/location/__tests__/validate.test.d.ts +0 -1
  121. package/dist/location/__tests__/validate.test.js +0 -107
  122. package/dist/node/__tests__/validate.test.d.ts +0 -1
  123. package/dist/node/__tests__/validate.test.js +0 -100
  124. package/dist/process-blueprint/__tests__/compliance-lane.test.d.ts +0 -1
  125. package/dist/process-blueprint/__tests__/compliance-lane.test.js +0 -272
  126. package/dist/process-blueprint/__tests__/layout.test.d.ts +0 -1
  127. package/dist/process-blueprint/__tests__/layout.test.js +0 -196
  128. package/dist/process-blueprint/__tests__/validate.test.d.ts +0 -1
  129. package/dist/process-blueprint/__tests__/validate.test.js +0 -280
  130. package/dist/process-map/__tests__/validate.test.d.ts +0 -1
  131. package/dist/process-map/__tests__/validate.test.js +0 -199
  132. package/dist/products/__tests__/validate.test.d.ts +0 -1
  133. package/dist/products/__tests__/validate.test.js +0 -210
  134. package/dist/repo-validate/__tests__/validate-repo.test.d.ts +0 -1
  135. package/dist/repo-validate/__tests__/validate-repo.test.js +0 -576
  136. package/dist/requirement/__tests__/example.test.d.ts +0 -1
  137. package/dist/requirement/__tests__/example.test.js +0 -21
  138. package/dist/requirement/__tests__/validate.test.d.ts +0 -1
  139. package/dist/requirement/__tests__/validate.test.js +0 -80
  140. package/dist/scenarios/__tests__/validate.test.d.ts +0 -1
  141. package/dist/scenarios/__tests__/validate.test.js +0 -183
  142. package/dist/stakeholder/__tests__/validate.test.d.ts +0 -1
  143. package/dist/stakeholder/__tests__/validate.test.js +0 -88
  144. package/dist/target-state/__tests__/validate.test.d.ts +0 -1
  145. package/dist/target-state/__tests__/validate.test.js +0 -78
  146. package/dist/technology-service/__tests__/validate.test.d.ts +0 -1
  147. package/dist/technology-service/__tests__/validate.test.js +0 -121
  148. package/dist/theme/__tests__/tokens.test.d.ts +0 -1
  149. package/dist/theme/__tests__/tokens.test.js +0 -159
  150. package/dist/webview/__tests__/entity-text-layout.test.d.ts +0 -1
  151. package/dist/webview/__tests__/entity-text-layout.test.js +0 -155
  152. package/dist/webview/__tests__/entry-notations.test.d.ts +0 -1
  153. package/dist/webview/__tests__/entry-notations.test.js +0 -62
  154. package/dist/webview/__tests__/entry.test.d.ts +0 -1
  155. package/dist/webview/__tests__/entry.test.js +0 -56
  156. package/dist/webview/__tests__/render-activities.test.d.ts +0 -1
  157. package/dist/webview/__tests__/render-activities.test.js +0 -91
  158. package/dist/webview/__tests__/render-blocks.test.d.ts +0 -1
  159. package/dist/webview/__tests__/render-blocks.test.js +0 -175
  160. package/dist/webview/__tests__/render-goals.test.d.ts +0 -1
  161. package/dist/webview/__tests__/render-goals.test.js +0 -120
  162. package/dist/webview/__tests__/render-process.test.d.ts +0 -1
  163. package/dist/webview/__tests__/render-process.test.js +0 -463
  164. package/dist/webview/__tests__/render-util.test.d.ts +0 -1
  165. package/dist/webview/__tests__/render-util.test.js +0 -54
  166. package/src/__tests__/edge-path.test.ts +0 -67
  167. package/src/__tests__/node-size-presets.test.ts +0 -50
  168. package/src/__tests__/scope.test.ts +0 -27
  169. package/src/__tests__/yaml-normalize.test.ts +0 -158
  170. package/src/activities/__tests__/cpm.test.ts +0 -164
  171. package/src/activities/__tests__/gantt.test.ts +0 -290
  172. package/src/activities/__tests__/layout.test.ts +0 -112
  173. package/src/activities/__tests__/validate.test.ts +0 -446
  174. package/src/activity-card/__tests__/example.test.ts +0 -83
  175. package/src/activity-card/__tests__/layout.test.ts +0 -162
  176. package/src/activity-card/__tests__/resolver.test.ts +0 -357
  177. package/src/activity-card/__tests__/validate.test.ts +0 -167
  178. package/src/actor/__tests__/validate.test.ts +0 -114
  179. package/src/applications/__tests__/validate.test.ts +0 -256
  180. package/src/assertion/__tests__/example.test.ts +0 -37
  181. package/src/assertion/__tests__/validate.test.ts +0 -142
  182. package/src/blocks/__tests__/layout.test.ts +0 -169
  183. package/src/blocks/__tests__/validate.test.ts +0 -260
  184. package/src/business-service/__tests__/validate.test.ts +0 -160
  185. package/src/capability-map/__tests__/CapabilityMapView.test.tsx +0 -232
  186. package/src/capability-map/__tests__/address.test.ts +0 -59
  187. package/src/capability-map/__tests__/dsm-layout.test.ts +0 -52
  188. package/src/capability-map/__tests__/dsm-mutations.test.ts +0 -141
  189. package/src/capability-map/__tests__/dsm-validate.test.ts +0 -65
  190. package/src/capability-map/__tests__/validate.test.ts +0 -238
  191. package/src/change/__tests__/validate.test.ts +0 -97
  192. package/src/codex/__tests__/example.test.ts +0 -40
  193. package/src/codex/__tests__/validate.test.ts +0 -84
  194. package/src/compliance/__tests__/canon-catalog.test.ts +0 -68
  195. package/src/compliance/__tests__/classify.test.ts +0 -64
  196. package/src/compliance/__tests__/confidence.test.ts +0 -98
  197. package/src/compliance/__tests__/coverage-metric.test.ts +0 -300
  198. package/src/compliance/__tests__/demo-scenario.test.ts +0 -273
  199. package/src/compliance/__tests__/example.test.ts +0 -57
  200. package/src/compliance/__tests__/gap-report.test.ts +0 -129
  201. package/src/compliance/__tests__/html.test.ts +0 -142
  202. package/src/compliance/__tests__/impact.test.ts +0 -1060
  203. package/src/compliance/__tests__/markdown.test.ts +0 -95
  204. package/src/compliance/__tests__/trace.test.ts +0 -157
  205. package/src/compliance/__tests__/view-resolution.test.ts +0 -80
  206. package/src/compliance/__tests__/views.test.ts +0 -64
  207. package/src/compliance-matrix/__tests__/build.test.ts +0 -200
  208. package/src/compliance-matrix/__tests__/example.test.ts +0 -57
  209. package/src/confidence/__tests__/score.test.ts +0 -254
  210. package/src/constraint/__tests__/example.test.ts +0 -19
  211. package/src/constraint/__tests__/validate.test.ts +0 -68
  212. package/src/factor/__tests__/validate.test.ts +0 -133
  213. package/src/fgca/__tests__/chain-table.test.ts +0 -172
  214. package/src/fgca/__tests__/layout.test.ts +0 -179
  215. package/src/fgca/__tests__/parse-canonical.test.ts +0 -296
  216. package/src/fgca/__tests__/preview-layout.test.ts +0 -124
  217. package/src/fgca/__tests__/resolver.test.ts +0 -209
  218. package/src/fgca/__tests__/validate.test.ts +0 -142
  219. package/src/goals/__tests__/GoalTreeView.test.tsx +0 -361
  220. package/src/goals/__tests__/layout.test.ts +0 -175
  221. package/src/goals/__tests__/mutations.test.ts +0 -153
  222. package/src/goals/__tests__/parse-canonical.test.ts +0 -147
  223. package/src/goals/__tests__/validate.test.ts +0 -202
  224. package/src/integration/__tests__/validate.test.ts +0 -203
  225. package/src/location/__tests__/validate.test.ts +0 -127
  226. package/src/node/__tests__/validate.test.ts +0 -118
  227. package/src/process-blueprint/__tests__/compliance-lane.test.ts +0 -320
  228. package/src/process-blueprint/__tests__/layout.test.ts +0 -240
  229. package/src/process-blueprint/__tests__/validate.test.ts +0 -310
  230. package/src/process-map/__tests__/validate.test.ts +0 -223
  231. package/src/products/__tests__/validate.test.ts +0 -239
  232. package/src/repo-validate/__tests__/validate-repo.test.ts +0 -699
  233. package/src/requirement/__tests__/example.test.ts +0 -24
  234. package/src/requirement/__tests__/validate.test.ts +0 -96
  235. package/src/scenarios/__tests__/validate.test.ts +0 -209
  236. package/src/stakeholder/__tests__/validate.test.ts +0 -105
  237. package/src/target-state/__tests__/validate.test.ts +0 -95
  238. package/src/technology-service/__tests__/validate.test.ts +0 -143
  239. package/src/theme/__tests__/tokens.test.ts +0 -185
  240. package/src/webview/__tests__/entity-text-layout.test.ts +0 -182
  241. package/src/webview/__tests__/entry-notations.test.ts +0 -77
  242. package/src/webview/__tests__/entry.test.ts +0 -64
  243. package/src/webview/__tests__/render-activities.test.ts +0 -100
  244. package/src/webview/__tests__/render-blocks.test.ts +0 -206
  245. package/src/webview/__tests__/render-goals.test.ts +0 -128
  246. package/src/webview/__tests__/render-process.test.ts +0 -538
  247. 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
- });