@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,80 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { validateRequirement } from '../validate.js';
3
- function valid() {
4
- return {
5
- notation: 'requirement',
6
- id: 'REQUIREMENT-DATA-ERASURE-1',
7
- name: 'Personal-data erasure within 30 days',
8
- description: 'The controller must erase personal data within 30 days of a verified request.',
9
- severity: 'high',
10
- zone: 'canon',
11
- admitted_at: '2026-05-28',
12
- admitted_by: 'v.korobeinikov',
13
- gate_checks: { uniqueness: 'pass', consistency: 'pass', completeness: 'pass' },
14
- valid_from: '2017-05-01',
15
- valid_to: null,
16
- };
17
- }
18
- const codes = (input, opts) => validateRequirement(input, opts).errors.map(e => e.code);
19
- describe('validateRequirement — positive', () => {
20
- it('accepts a well-formed requirement', () => {
21
- const r = validateRequirement(valid());
22
- expect(r.valid, JSON.stringify(r.errors)).toBe(true);
23
- expect(r.errors).toHaveLength(0);
24
- });
25
- it('accepts an internal-only requirement with no derived_from', () => {
26
- const r = valid();
27
- delete r.derived_from;
28
- r.severity = 'medium';
29
- expect(validateRequirement(r).valid).toBe(true);
30
- });
31
- });
32
- describe('validateRequirement — REQ-001 (shape / id grammar)', () => {
33
- it('flags a missing required field', () => {
34
- const r = valid();
35
- delete r.name;
36
- expect(codes(r)).toContain('REQ-001');
37
- });
38
- it('flags an id that violates the grammar', () => {
39
- expect(codes({ ...valid(), id: 'REQUIREMENT-DATA-ERASURE-001' })).toContain('REQ-001'); // leading zero
40
- expect(codes({ ...valid(), id: 'REQ-1' })).toContain('REQ-001'); // wrong TYPE
41
- expect(codes({ ...valid(), id: 'requirement-data-1' })).toContain('REQ-001'); // lowercase TYPE
42
- });
43
- it('flags a wrong notation tag and a non-canon zone', () => {
44
- expect(codes({ ...valid(), notation: 'req' })).toContain('REQ-001');
45
- expect(codes({ ...valid(), zone: 'sandbox' })).toContain('REQ-001');
46
- });
47
- it('flags a missing valid_to key (distinct from a null value)', () => {
48
- const r = valid();
49
- delete r.valid_to;
50
- expect(codes(r)).toContain('REQ-001');
51
- expect(validateRequirement({ ...valid(), valid_to: null }).valid).toBe(true);
52
- });
53
- it('rejects a non-object', () => {
54
- expect(codes(null)).toEqual(['REQ-001']);
55
- expect(codes('x')).toEqual(['REQ-001']);
56
- expect(codes(['a'])).toEqual(['REQ-001']);
57
- });
58
- });
59
- describe('validateRequirement — REQ-002 (derived_from resolution)', () => {
60
- it('flags a well-formed allowed-type ref that does not resolve in the catalog', () => {
61
- const catalog = { typeOf: () => undefined };
62
- expect(codes({ ...valid(), derived_from: ['LAW-PERSONAL-DATA-2017-1'] }, { catalog })).toContain('REQ-002');
63
- });
64
- it('flags a malformed derived_from entry (cannot resolve)', () => {
65
- expect(codes({ ...valid(), derived_from: ['not an id'] })).toContain('REQ-002');
66
- });
67
- it('does not flag REQ-002 without a catalog for a well-formed allowed-type ref', () => {
68
- expect(codes({ ...valid(), derived_from: ['LAW-PERSONAL-DATA-2017-1'] })).not.toContain('REQ-002');
69
- });
70
- });
71
- describe('validateRequirement — REQ-003 (derived_from TYPE)', () => {
72
- it('flags a derived_from TYPE outside LAW/REGULATION/POLICY/INTERNAL_STANDARD', () => {
73
- expect(codes({ ...valid(), derived_from: ['PRODUCT-MOBILE-1'] })).toContain('REQ-003');
74
- });
75
- it('accepts each permitted derived_from TYPE', () => {
76
- for (const id of ['LAW-X-1', 'REGULATION-X-1', 'POLICY-X-1', 'INTERNAL_STANDARD-X-1']) {
77
- expect(codes({ ...valid(), derived_from: [id] })).not.toContain('REQ-003');
78
- }
79
- });
80
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,183 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import * as fs from 'node:fs';
3
- import * as path from 'node:path';
4
- import yaml from 'js-yaml';
5
- import { validateScenario } from '../validate.js';
6
- const EXAMPLES_DIR = path.resolve(process.cwd(), '..', '..', 'tests', 'fixtures', 'notation-corpus', 'scenarios');
7
- const VALID_SCENARIO = {
8
- notation: 'scenarios',
9
- scenario: {
10
- id: 'SCN-001',
11
- name: 'Optimistic Growth 2027',
12
- status: 'Active',
13
- created_at: '2026-01-01',
14
- vision: 'Aggressive expansion scenario.',
15
- factors_view: [
16
- { factor_id: 'FAC-MARKET-001', relevance: 'High', impact: 'Revenue growth' },
17
- { factor_id: 'FAC-TECH-001', relevance: 'Medium' },
18
- ],
19
- goals: [{ goal_id: 'GOAL-REV-001' }],
20
- capabilities: [{ capability_id: 'CAP-ECOMM-001' }],
21
- activities: [{ activity_id: 'ACT-EXPAND-001' }],
22
- products: [{ product_id: 'PROD-PLATFORM-001' }],
23
- processes: [{ process_id: 'PROC-DELIVERY-001' }],
24
- applications: [{ app_id: 'APP-CRM-001' }, { app_id: 'APP-OMS-001' }],
25
- },
26
- };
27
- describe('validateScenario', () => {
28
- it('passes on valid input', () => {
29
- const r = validateScenario(VALID_SCENARIO);
30
- expect(r.valid).toBe(true);
31
- expect(r.errors).toHaveLength(0);
32
- });
33
- it('SCN-001: rejects non-object input', () => {
34
- const r = validateScenario(null);
35
- expect(r.errors[0].code).toBe('SCN-001');
36
- });
37
- it('SCN-001: rejects missing notation', () => {
38
- const { notation: _, ...rest } = VALID_SCENARIO;
39
- const r = validateScenario(rest);
40
- expect(r.errors.some(e => e.code === 'SCN-001')).toBe(true);
41
- });
42
- it('SCN-001: rejects wrong notation value', () => {
43
- const r = validateScenario({ ...VALID_SCENARIO, notation: 'goals' });
44
- expect(r.errors.some(e => e.code === 'SCN-001')).toBe(true);
45
- });
46
- it('SCN-002: rejects missing scenario', () => {
47
- const r = validateScenario({ notation: 'scenarios' });
48
- expect(r.errors.some(e => e.code === 'SCN-002')).toBe(true);
49
- });
50
- it('SCN-002: rejects missing id/name/status', () => {
51
- const r = validateScenario({ notation: 'scenarios', scenario: {} });
52
- expect(r.errors.filter(e => e.code === 'SCN-002').length).toBeGreaterThanOrEqual(3);
53
- });
54
- it('SCN-003: rejects invalid status', () => {
55
- const scn = { ...VALID_SCENARIO.scenario, status: 'Retired' };
56
- const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
57
- expect(r.errors.some(e => e.code === 'SCN-003')).toBe(true);
58
- });
59
- it('SCN-003: accepts all valid statuses', () => {
60
- for (const status of ['Draft', 'Active', 'Archived']) {
61
- const scn = { ...VALID_SCENARIO.scenario, status };
62
- const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
63
- expect(r.errors.some(e => e.code === 'SCN-003')).toBe(false);
64
- }
65
- });
66
- it('SCN-004: rejects malformed created_at', () => {
67
- const scn = { ...VALID_SCENARIO.scenario, created_at: '01-01-2026' };
68
- const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
69
- expect(r.errors.some(e => e.code === 'SCN-004')).toBe(true);
70
- });
71
- it('SCN-004: accepts missing created_at', () => {
72
- const { created_at: _, ...scn } = VALID_SCENARIO.scenario;
73
- const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
74
- expect(r.errors.some(e => e.code === 'SCN-004')).toBe(false);
75
- });
76
- it('SCN-005: rejects non-array factors_view', () => {
77
- const scn = { ...VALID_SCENARIO.scenario, factors_view: 'oops' };
78
- const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
79
- expect(r.errors.some(e => e.code === 'SCN-005')).toBe(true);
80
- });
81
- it('SCN-005: rejects factor missing factor_id', () => {
82
- const scn = { ...VALID_SCENARIO.scenario, factors_view: [{ relevance: 'High' }] };
83
- const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
84
- expect(r.errors.some(e => e.code === 'SCN-005')).toBe(true);
85
- });
86
- it('SCN-006: rejects invalid factor relevance', () => {
87
- const scn = {
88
- ...VALID_SCENARIO.scenario,
89
- factors_view: [{ factor_id: 'F1', relevance: 'Critical' }],
90
- };
91
- const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
92
- expect(r.errors.some(e => e.code === 'SCN-006')).toBe(true);
93
- });
94
- it('SCN-013: rejects duplicate factor_id', () => {
95
- const scn = {
96
- ...VALID_SCENARIO.scenario,
97
- factors_view: [{ factor_id: 'F1' }, { factor_id: 'F1' }],
98
- };
99
- const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
100
- expect(r.errors.some(e => e.code === 'SCN-013')).toBe(true);
101
- });
102
- const refCases = [
103
- { field: 'goals', idField: 'goal_id', errorCode: 'SCN-007' },
104
- { field: 'capabilities', idField: 'capability_id', errorCode: 'SCN-008' },
105
- { field: 'activities', idField: 'activity_id', errorCode: 'SCN-009' },
106
- { field: 'products', idField: 'product_id', errorCode: 'SCN-010' },
107
- { field: 'processes', idField: 'process_id', errorCode: 'SCN-011' },
108
- { field: 'applications', idField: 'app_id', errorCode: 'SCN-012' },
109
- ];
110
- for (const c of refCases) {
111
- it(`${c.errorCode}: rejects ${c.field}[*] missing ${c.idField}`, () => {
112
- const scn = { ...VALID_SCENARIO.scenario, [c.field]: [{}] };
113
- const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
114
- expect(r.errors.some(e => e.code === c.errorCode)).toBe(true);
115
- });
116
- it(`${c.errorCode}: rejects non-array ${c.field}`, () => {
117
- const scn = { ...VALID_SCENARIO.scenario, [c.field]: 'oops' };
118
- const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
119
- expect(r.errors.some(e => e.code === c.errorCode)).toBe(true);
120
- });
121
- it(`${c.errorCode}: rejects duplicate ${c.idField}`, () => {
122
- const scn = {
123
- ...VALID_SCENARIO.scenario,
124
- [c.field]: [{ [c.idField]: 'X1' }, { [c.idField]: 'X1' }],
125
- };
126
- const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
127
- expect(r.errors.some(e => e.code === c.errorCode)).toBe(true);
128
- });
129
- }
130
- it('accepts minimal scenario (id+name+status only)', () => {
131
- const r = validateScenario({
132
- notation: 'scenarios',
133
- scenario: { id: 'S1', name: 'Minimal', status: 'Draft' },
134
- });
135
- expect(r.valid).toBe(true);
136
- });
137
- it('accepts scenario with all reference lists empty', () => {
138
- const scn = {
139
- ...VALID_SCENARIO.scenario,
140
- factors_view: [],
141
- goals: [],
142
- capabilities: [],
143
- activities: [],
144
- products: [],
145
- processes: [],
146
- applications: [],
147
- };
148
- const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
149
- expect(r.valid).toBe(true);
150
- });
151
- // Pre-release blocker regression (orchestrator review 2026-05-21).
152
- it('[blocker] tolerates a null element in factors_view[] without throwing', () => {
153
- const scn = { ...VALID_SCENARIO.scenario, factors_view: [null] };
154
- const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
155
- expect(r.valid).toBe(false);
156
- expect(r.errors.some(e => e.code === 'SCN-005')).toBe(true);
157
- });
158
- it('[blocker] tolerates a null element in goals[] without throwing', () => {
159
- const scn = { ...VALID_SCENARIO.scenario, goals: [null] };
160
- const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
161
- expect(r.valid).toBe(false);
162
- expect(r.errors.some(e => e.code === 'SCN-007')).toBe(true);
163
- });
164
- it('[blocker] tolerates a string element in applications[] without throwing', () => {
165
- const scn = { ...VALID_SCENARIO.scenario, applications: ['x'] };
166
- const r = validateScenario({ ...VALID_SCENARIO, scenario: scn });
167
- expect(r.valid).toBe(false);
168
- expect(r.errors.some(e => e.code === 'SCN-012')).toBe(true);
169
- });
170
- });
171
- describe('scenarios examples (regression)', () => {
172
- const files = fs.readdirSync(EXAMPLES_DIR).filter(f => f.endsWith('.yaml'));
173
- expect(files.length).toBeGreaterThan(0);
174
- for (const file of files) {
175
- it(`validates tests/fixtures/notation-corpus/scenarios/${file}`, () => {
176
- const text = fs.readFileSync(path.join(EXAMPLES_DIR, file), 'utf8');
177
- const parsed = yaml.load(text);
178
- const r = validateScenario(parsed);
179
- expect(r.errors).toEqual([]);
180
- expect(r.valid).toBe(true);
181
- });
182
- }
183
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,88 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { validateStakeholder } from '../validate.js';
3
- function valid() {
4
- return {
5
- notation: 'stakeholder',
6
- id: 'STAKEHOLDER-DPA-1',
7
- name: 'Data Protection Authority',
8
- type: 'external',
9
- actor: 'ACTOR-DPA-1',
10
- concern: 'Lawful processing and timely erasure of personal data.',
11
- interest: 'high',
12
- influence: 'high',
13
- description: 'External oversight stakeholder.',
14
- zone: 'canon',
15
- admitted_at: '2026-05-29',
16
- admitted_by: 'v.korobeinikov',
17
- gate_checks: { uniqueness: 'pass', consistency: 'pass', completeness: 'pass' },
18
- valid_from: '2018-05-25',
19
- valid_to: null,
20
- };
21
- }
22
- const codes = (input, opts) => validateStakeholder(input, opts).errors.map(e => e.code);
23
- describe('validateStakeholder — positive', () => {
24
- it('accepts a well-formed external stakeholder', () => {
25
- const r = validateStakeholder(valid());
26
- expect(r.valid, JSON.stringify(r.errors)).toBe(true);
27
- });
28
- it('accepts a minimal internal stakeholder with no optional profile fields', () => {
29
- const s = valid();
30
- s.id = 'STAKEHOLDER-OPS-1';
31
- s.name = 'Operations';
32
- s.type = 'internal';
33
- s.actor = 'ACTOR-OPS-1';
34
- delete s.concern;
35
- delete s.interest;
36
- delete s.influence;
37
- delete s.description;
38
- expect(validateStakeholder(s).valid).toBe(true);
39
- });
40
- it('accepts when the catalog resolves the actor', () => {
41
- const catalog = { typeOf: id => (id === 'ACTOR-DPA-1' ? 'ACTOR' : undefined) };
42
- expect(validateStakeholder(valid(), { catalog }).valid).toBe(true);
43
- });
44
- });
45
- describe('validateStakeholder — STAKE-001 (shape / id grammar / levels)', () => {
46
- it('flags a missing required envelope field', () => {
47
- const s = valid();
48
- delete s.name;
49
- expect(codes(s)).toContain('STAKE-001');
50
- });
51
- it('flags an id that violates the grammar', () => {
52
- expect(codes({ ...valid(), id: 'STAKEHOLDER-DPA-001' })).toContain('STAKE-001');
53
- expect(codes({ ...valid(), id: 'STAKE-1' })).toContain('STAKE-001');
54
- });
55
- it('flags a wrong notation tag', () => {
56
- expect(codes({ ...valid(), notation: 'stakeholders' })).toContain('STAKE-001');
57
- });
58
- it('flags an interest / influence value outside {high, medium, low}', () => {
59
- expect(codes({ ...valid(), interest: 'critical' })).toContain('STAKE-001');
60
- expect(codes({ ...valid(), influence: 'none' })).toContain('STAKE-001');
61
- });
62
- it('rejects a non-object', () => {
63
- expect(codes(null)).toEqual(['STAKE-001']);
64
- });
65
- });
66
- describe('validateStakeholder — STAKE-002 (actor binding)', () => {
67
- it('flags a missing actor', () => {
68
- const s = valid();
69
- delete s.actor;
70
- expect(codes(s)).toContain('STAKE-002');
71
- });
72
- it('flags an actor of the wrong TYPE', () => {
73
- expect(codes({ ...valid(), actor: 'ROLE-OPS-1' })).toContain('STAKE-002');
74
- });
75
- it('flags an actor that does not resolve when a catalog is supplied', () => {
76
- const catalog = { typeOf: () => undefined };
77
- expect(codes(valid(), { catalog })).toContain('STAKE-002');
78
- });
79
- it('flags an actor whose catalog TYPE is not ACTOR', () => {
80
- const catalog = { typeOf: () => 'ROLE' };
81
- expect(codes(valid(), { catalog })).toContain('STAKE-002');
82
- });
83
- });
84
- describe('validateStakeholder — STAKE-003 (type enum)', () => {
85
- it('flags a type outside {internal, external}', () => {
86
- expect(codes({ ...valid(), type: 'partner' })).toContain('STAKE-003');
87
- });
88
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,78 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { validateTargetState } from '../validate.js';
3
- function valid() {
4
- return {
5
- notation: 'target-state',
6
- id: 'TARGET_STATE-EU-LIVE-1',
7
- name: 'EU operations live — three markets, localised CRM and payments',
8
- description: 'The structural end-state.',
9
- capabilities: ['CAPABILITY-V1', 'CAPABILITY-V1.2', 'CAPABILITY-V2'],
10
- processes: ['PROCESS-CUST-ONBOARD-1', 'PROCESS-ORD-FULFILL-1'],
11
- applications: ['APPLICATION-CRM-1', 'APPLICATION-OMS-1'],
12
- zone: 'canon',
13
- admitted_at: '2026-05-31',
14
- admitted_by: 'v.korobeinikov',
15
- gate_checks: { uniqueness: 'pass', consistency: 'pass', completeness: 'pass' },
16
- valid_from: '2026-05-31',
17
- valid_to: null,
18
- };
19
- }
20
- const codes = (input, opts) => validateTargetState(input, opts).errors.map(e => e.code);
21
- describe('validateTargetState — positive', () => {
22
- it('accepts a well-formed target state', () => {
23
- const r = validateTargetState(valid());
24
- expect(r.valid, JSON.stringify(r.errors)).toBe(true);
25
- });
26
- it('accepts a target state with empty composition lists', () => {
27
- const t = valid();
28
- delete t.capabilities;
29
- delete t.processes;
30
- delete t.applications;
31
- expect(validateTargetState(t).valid).toBe(true);
32
- });
33
- it('accepts CAPABILITY V/H ids without integer terminal', () => {
34
- const t = valid();
35
- t.capabilities = ['CAPABILITY-V1.2.3', 'CAPABILITY-H1.2'];
36
- expect(validateTargetState(t).valid).toBe(true);
37
- });
38
- });
39
- describe('validateTargetState — TSTATE-001 (shape / id grammar)', () => {
40
- it('flags a missing required envelope field', () => {
41
- const t = valid();
42
- delete t.name;
43
- expect(codes(t)).toContain('TSTATE-001');
44
- });
45
- it('flags an id that violates the grammar', () => {
46
- expect(codes({ ...valid(), id: 'TARGET_STATE-EU-LIVE-001' })).toContain('TSTATE-001');
47
- expect(codes({ ...valid(), id: 'TS-1' })).toContain('TSTATE-001');
48
- });
49
- it('flags a wrong notation tag', () => {
50
- expect(codes({ ...valid(), notation: 'target_state' })).toContain('TSTATE-001');
51
- });
52
- it('flags a non-array composition list', () => {
53
- expect(codes({ ...valid(), capabilities: 'CAPABILITY-V1' })).toContain('TSTATE-001');
54
- });
55
- it('rejects a non-object', () => {
56
- expect(codes(null)).toEqual(['TSTATE-001']);
57
- });
58
- });
59
- describe('validateTargetState — TSTATE-002 (composition TYPEs)', () => {
60
- it('flags a capabilities entry of the wrong TYPE', () => {
61
- expect(codes({ ...valid(), capabilities: ['PROCESS-X-1'] })).toContain('TSTATE-002');
62
- });
63
- it('flags a processes entry of the wrong TYPE', () => {
64
- expect(codes({ ...valid(), processes: ['APPLICATION-X-1'] })).toContain('TSTATE-002');
65
- });
66
- it('flags an applications entry of the wrong TYPE', () => {
67
- expect(codes({ ...valid(), applications: ['CAPABILITY-V1'] })).toContain('TSTATE-002');
68
- });
69
- it('flags an unresolved id when a catalog is supplied', () => {
70
- const catalog = { typeOf: () => undefined };
71
- expect(codes(valid(), { catalog })).toContain('TSTATE-002');
72
- });
73
- });
74
- describe('validateTargetState — TSTATE-003 (forbidden inline goals)', () => {
75
- it('flags an inline goals field', () => {
76
- expect(codes({ ...valid(), goals: ['GOAL-EU-1'] })).toContain('TSTATE-003');
77
- });
78
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,121 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { validateTechnologyService } from '../validate.js';
3
- function valid() {
4
- return {
5
- notation: 'technology-service',
6
- id: 'TECHNOLOGY_SERVICE-KAFKA-1',
7
- name: 'Kafka Event Bus',
8
- type: 'messaging',
9
- description: 'Managed Kafka cluster for async event streaming.',
10
- node: 'NODE-KAFKA-HOST-1',
11
- endpoint: 'kafka.internal:9092',
12
- zone: 'canon',
13
- admitted_at: '2026-06-28',
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
- const codes = (input) => validateTechnologyService(input).errors.map(e => e.code);
21
- describe('validateTechnologyService — positive', () => {
22
- it('accepts a well-formed messaging service with all optional fields', () => {
23
- const r = validateTechnologyService(valid());
24
- expect(r.valid, JSON.stringify(r.errors)).toBe(true);
25
- });
26
- it('accepts a storage service with no optional fields', () => {
27
- const a = valid();
28
- a.id = 'TECHNOLOGY_SERVICE-S3-1';
29
- a.name = 'Object Storage';
30
- a.type = 'storage';
31
- delete a.description;
32
- delete a.node;
33
- delete a.endpoint;
34
- expect(validateTechnologyService(a).valid).toBe(true);
35
- });
36
- it('accepts all five type values', () => {
37
- for (const t of ['messaging', 'storage', 'api_gateway', 'database', 'compute']) {
38
- expect(validateTechnologyService({ ...valid(), type: t }).valid).toBe(true);
39
- }
40
- });
41
- it('accepts valid_to as a date string', () => {
42
- expect(validateTechnologyService({ ...valid(), valid_to: '2026-12-31' }).valid).toBe(true);
43
- });
44
- it('accepts absent node without error', () => {
45
- const a = valid();
46
- delete a.node;
47
- expect(validateTechnologyService(a).valid).toBe(true);
48
- });
49
- });
50
- describe('validateTechnologyService — TSVC-001 (shape / id grammar)', () => {
51
- it('flags a non-object input', () => {
52
- expect(codes(null)).toEqual(['TSVC-001']);
53
- });
54
- it('flags an id that violates the grammar', () => {
55
- expect(codes({ ...valid(), id: 'TECHNOLOGY_SERVICE-001' })).toContain('TSVC-001');
56
- expect(codes({ ...valid(), id: 'TSVC-1' })).toContain('TSVC-001');
57
- expect(codes({ ...valid(), id: 'technology-service-kafka-1' })).toContain('TSVC-001');
58
- });
59
- it('flags a wrong notation tag', () => {
60
- expect(codes({ ...valid(), notation: 'technology_service' })).toContain('TSVC-001');
61
- expect(codes({ ...valid(), notation: 'service' })).toContain('TSVC-001');
62
- });
63
- it('flags a non-canon zone', () => {
64
- expect(codes({ ...valid(), zone: 'sandbox' })).toContain('TSVC-001');
65
- });
66
- it('flags a missing zone', () => {
67
- const a = valid();
68
- delete a.zone;
69
- expect(codes(a)).toContain('TSVC-001');
70
- });
71
- it('flags a missing name', () => {
72
- const a = valid();
73
- delete a.name;
74
- expect(codes(a)).toContain('TSVC-001');
75
- });
76
- it('flags a missing valid_to key', () => {
77
- const a = valid();
78
- delete a.valid_to;
79
- expect(codes(a)).toContain('TSVC-001');
80
- });
81
- it('flags missing gate_checks', () => {
82
- const a = valid();
83
- delete a.gate_checks;
84
- expect(codes(a)).toContain('TSVC-001');
85
- });
86
- it('flags a missing type', () => {
87
- const a = valid();
88
- delete a.type;
89
- expect(codes(a)).toContain('TSVC-001');
90
- });
91
- });
92
- describe('validateTechnologyService — TSVC-002 (type enum)', () => {
93
- it('flags a type outside the allowed enum', () => {
94
- expect(codes({ ...valid(), type: 'queue' })).toContain('TSVC-002');
95
- expect(codes({ ...valid(), type: 'event_streaming' })).toContain('TSVC-002');
96
- expect(codes({ ...valid(), type: 'cache' })).toContain('TSVC-002');
97
- });
98
- it('does not flag a missing type with TSVC-002 (TSVC-001 fires instead)', () => {
99
- const a = valid();
100
- delete a.type;
101
- expect(codes(a)).not.toContain('TSVC-002');
102
- expect(codes(a)).toContain('TSVC-001');
103
- });
104
- });
105
- describe('validateTechnologyService — TSVC-003 (node grammar)', () => {
106
- it('flags a node reference that is not a NODE-… id', () => {
107
- expect(codes({ ...valid(), node: 'ACTOR-OPS-1' })).toContain('TSVC-003');
108
- expect(codes({ ...valid(), node: 'not-an-id' })).toContain('TSVC-003');
109
- expect(codes({ ...valid(), node: 'NODE-001' })).toContain('TSVC-003');
110
- });
111
- it('accepts a null or absent node without error', () => {
112
- expect(codes({ ...valid(), node: undefined })).not.toContain('TSVC-003');
113
- const a = valid();
114
- delete a.node;
115
- expect(codes(a)).not.toContain('TSVC-003');
116
- });
117
- it('accepts a well-formed NODE-… id', () => {
118
- expect(codes({ ...valid(), node: 'NODE-KAFKA-HOST-1' })).not.toContain('TSVC-003');
119
- expect(codes({ ...valid(), node: 'NODE-K8S-CLUSTER-1' })).not.toContain('TSVC-003');
120
- });
121
- });
@@ -1 +0,0 @@
1
- export {};