@transitrix/diagrams 1.8.6 → 1.8.8

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 (251) hide show
  1. package/dist/fgca/index.js +10 -10
  2. package/dist/fgca/layout.js +1 -1
  3. package/dist/fgca/nodeTypes.js +4 -4
  4. package/dist/index.js +33 -33
  5. package/package.json +8 -2
  6. package/dist/__tests__/edge-path.test.d.ts +0 -1
  7. package/dist/__tests__/edge-path.test.js +0 -55
  8. package/dist/__tests__/node-size-presets.test.d.ts +0 -1
  9. package/dist/__tests__/node-size-presets.test.js +0 -30
  10. package/dist/__tests__/scope.test.d.ts +0 -1
  11. package/dist/__tests__/scope.test.js +0 -23
  12. package/dist/__tests__/yaml-normalize.test.d.ts +0 -1
  13. package/dist/__tests__/yaml-normalize.test.js +0 -148
  14. package/dist/activities/__tests__/cpm.test.d.ts +0 -1
  15. package/dist/activities/__tests__/cpm.test.js +0 -146
  16. package/dist/activities/__tests__/gantt.test.d.ts +0 -1
  17. package/dist/activities/__tests__/gantt.test.js +0 -263
  18. package/dist/activities/__tests__/layout.test.d.ts +0 -1
  19. package/dist/activities/__tests__/layout.test.js +0 -98
  20. package/dist/activities/__tests__/validate.test.d.ts +0 -1
  21. package/dist/activities/__tests__/validate.test.js +0 -397
  22. package/dist/activity-card/__tests__/example.test.d.ts +0 -1
  23. package/dist/activity-card/__tests__/example.test.js +0 -73
  24. package/dist/activity-card/__tests__/layout.test.d.ts +0 -1
  25. package/dist/activity-card/__tests__/layout.test.js +0 -141
  26. package/dist/activity-card/__tests__/resolver.test.d.ts +0 -1
  27. package/dist/activity-card/__tests__/resolver.test.js +0 -325
  28. package/dist/activity-card/__tests__/validate.test.d.ts +0 -1
  29. package/dist/activity-card/__tests__/validate.test.js +0 -149
  30. package/dist/actor/__tests__/validate.test.d.ts +0 -1
  31. package/dist/actor/__tests__/validate.test.js +0 -95
  32. package/dist/applications/__tests__/validate.test.d.ts +0 -1
  33. package/dist/applications/__tests__/validate.test.js +0 -223
  34. package/dist/assertion/__tests__/example.test.d.ts +0 -1
  35. package/dist/assertion/__tests__/example.test.js +0 -32
  36. package/dist/assertion/__tests__/validate.test.d.ts +0 -1
  37. package/dist/assertion/__tests__/validate.test.js +0 -130
  38. package/dist/blocks/__tests__/layout.test.d.ts +0 -1
  39. package/dist/blocks/__tests__/layout.test.js +0 -153
  40. package/dist/blocks/__tests__/validate.test.d.ts +0 -1
  41. package/dist/blocks/__tests__/validate.test.js +0 -235
  42. package/dist/business-service/__tests__/validate.test.d.ts +0 -1
  43. package/dist/business-service/__tests__/validate.test.js +0 -135
  44. package/dist/capability-map/__tests__/CapabilityMapView.test.d.ts +0 -1
  45. package/dist/capability-map/__tests__/CapabilityMapView.test.js +0 -217
  46. package/dist/capability-map/__tests__/address.test.d.ts +0 -1
  47. package/dist/capability-map/__tests__/address.test.js +0 -49
  48. package/dist/capability-map/__tests__/dsm-layout.test.d.ts +0 -1
  49. package/dist/capability-map/__tests__/dsm-layout.test.js +0 -46
  50. package/dist/capability-map/__tests__/dsm-mutations.test.d.ts +0 -1
  51. package/dist/capability-map/__tests__/dsm-mutations.test.js +0 -125
  52. package/dist/capability-map/__tests__/dsm-validate.test.d.ts +0 -1
  53. package/dist/capability-map/__tests__/dsm-validate.test.js +0 -56
  54. package/dist/capability-map/__tests__/validate.test.d.ts +0 -1
  55. package/dist/capability-map/__tests__/validate.test.js +0 -212
  56. package/dist/change/__tests__/validate.test.d.ts +0 -1
  57. package/dist/change/__tests__/validate.test.js +0 -79
  58. package/dist/codex/__tests__/example.test.d.ts +0 -1
  59. package/dist/codex/__tests__/example.test.js +0 -33
  60. package/dist/codex/__tests__/validate.test.d.ts +0 -1
  61. package/dist/codex/__tests__/validate.test.js +0 -68
  62. package/dist/compliance/__tests__/canon-catalog.test.d.ts +0 -1
  63. package/dist/compliance/__tests__/canon-catalog.test.js +0 -60
  64. package/dist/compliance/__tests__/classify.test.d.ts +0 -1
  65. package/dist/compliance/__tests__/classify.test.js +0 -58
  66. package/dist/compliance/__tests__/confidence.test.d.ts +0 -1
  67. package/dist/compliance/__tests__/confidence.test.js +0 -78
  68. package/dist/compliance/__tests__/coverage-metric.test.d.ts +0 -1
  69. package/dist/compliance/__tests__/coverage-metric.test.js +0 -264
  70. package/dist/compliance/__tests__/demo-scenario.test.d.ts +0 -1
  71. package/dist/compliance/__tests__/demo-scenario.test.js +0 -226
  72. package/dist/compliance/__tests__/example.test.d.ts +0 -1
  73. package/dist/compliance/__tests__/example.test.js +0 -51
  74. package/dist/compliance/__tests__/gap-report.test.d.ts +0 -1
  75. package/dist/compliance/__tests__/gap-report.test.js +0 -113
  76. package/dist/compliance/__tests__/html.test.d.ts +0 -1
  77. package/dist/compliance/__tests__/html.test.js +0 -122
  78. package/dist/compliance/__tests__/impact.test.d.ts +0 -1
  79. package/dist/compliance/__tests__/impact.test.js +0 -913
  80. package/dist/compliance/__tests__/markdown.test.d.ts +0 -1
  81. package/dist/compliance/__tests__/markdown.test.js +0 -85
  82. package/dist/compliance/__tests__/trace.test.d.ts +0 -1
  83. package/dist/compliance/__tests__/trace.test.js +0 -144
  84. package/dist/compliance/__tests__/view-resolution.test.d.ts +0 -1
  85. package/dist/compliance/__tests__/view-resolution.test.js +0 -59
  86. package/dist/compliance/__tests__/views.test.d.ts +0 -1
  87. package/dist/compliance/__tests__/views.test.js +0 -59
  88. package/dist/compliance-matrix/__tests__/build.test.d.ts +0 -1
  89. package/dist/compliance-matrix/__tests__/build.test.js +0 -183
  90. package/dist/compliance-matrix/__tests__/example.test.d.ts +0 -1
  91. package/dist/compliance-matrix/__tests__/example.test.js +0 -49
  92. package/dist/confidence/__tests__/score.test.d.ts +0 -1
  93. package/dist/confidence/__tests__/score.test.js +0 -188
  94. package/dist/constraint/__tests__/example.test.d.ts +0 -1
  95. package/dist/constraint/__tests__/example.test.js +0 -14
  96. package/dist/constraint/__tests__/validate.test.d.ts +0 -1
  97. package/dist/constraint/__tests__/validate.test.js +0 -58
  98. package/dist/factor/__tests__/validate.test.d.ts +0 -1
  99. package/dist/factor/__tests__/validate.test.js +0 -112
  100. package/dist/fgca/__tests__/chain-table.test.d.ts +0 -1
  101. package/dist/fgca/__tests__/chain-table.test.js +0 -158
  102. package/dist/fgca/__tests__/layout.test.d.ts +0 -1
  103. package/dist/fgca/__tests__/layout.test.js +0 -140
  104. package/dist/fgca/__tests__/parse-canonical.test.d.ts +0 -1
  105. package/dist/fgca/__tests__/parse-canonical.test.js +0 -268
  106. package/dist/fgca/__tests__/preview-layout.test.d.ts +0 -1
  107. package/dist/fgca/__tests__/preview-layout.test.js +0 -106
  108. package/dist/fgca/__tests__/resolver.test.d.ts +0 -1
  109. package/dist/fgca/__tests__/resolver.test.js +0 -185
  110. package/dist/fgca/__tests__/validate.test.d.ts +0 -1
  111. package/dist/fgca/__tests__/validate.test.js +0 -125
  112. package/dist/goals/__tests__/GoalTreeView.test.d.ts +0 -1
  113. package/dist/goals/__tests__/GoalTreeView.test.js +0 -337
  114. package/dist/goals/__tests__/layout.test.d.ts +0 -1
  115. package/dist/goals/__tests__/layout.test.js +0 -153
  116. package/dist/goals/__tests__/mutations.test.d.ts +0 -1
  117. package/dist/goals/__tests__/mutations.test.js +0 -134
  118. package/dist/goals/__tests__/parse-canonical.test.d.ts +0 -1
  119. package/dist/goals/__tests__/parse-canonical.test.js +0 -131
  120. package/dist/goals/__tests__/validate.test.d.ts +0 -1
  121. package/dist/goals/__tests__/validate.test.js +0 -183
  122. package/dist/integration/__tests__/validate.test.d.ts +0 -1
  123. package/dist/integration/__tests__/validate.test.js +0 -169
  124. package/dist/location/__tests__/validate.test.d.ts +0 -1
  125. package/dist/location/__tests__/validate.test.js +0 -107
  126. package/dist/node/__tests__/validate.test.d.ts +0 -1
  127. package/dist/node/__tests__/validate.test.js +0 -100
  128. package/dist/process-blueprint/__tests__/compliance-lane.test.d.ts +0 -1
  129. package/dist/process-blueprint/__tests__/compliance-lane.test.js +0 -272
  130. package/dist/process-blueprint/__tests__/layout.test.d.ts +0 -1
  131. package/dist/process-blueprint/__tests__/layout.test.js +0 -196
  132. package/dist/process-blueprint/__tests__/validate.test.d.ts +0 -1
  133. package/dist/process-blueprint/__tests__/validate.test.js +0 -280
  134. package/dist/process-map/__tests__/validate.test.d.ts +0 -1
  135. package/dist/process-map/__tests__/validate.test.js +0 -199
  136. package/dist/products/__tests__/validate.test.d.ts +0 -1
  137. package/dist/products/__tests__/validate.test.js +0 -210
  138. package/dist/repo-validate/__tests__/validate-repo.test.d.ts +0 -1
  139. package/dist/repo-validate/__tests__/validate-repo.test.js +0 -576
  140. package/dist/requirement/__tests__/example.test.d.ts +0 -1
  141. package/dist/requirement/__tests__/example.test.js +0 -21
  142. package/dist/requirement/__tests__/validate.test.d.ts +0 -1
  143. package/dist/requirement/__tests__/validate.test.js +0 -80
  144. package/dist/scenarios/__tests__/validate.test.d.ts +0 -1
  145. package/dist/scenarios/__tests__/validate.test.js +0 -183
  146. package/dist/stakeholder/__tests__/validate.test.d.ts +0 -1
  147. package/dist/stakeholder/__tests__/validate.test.js +0 -88
  148. package/dist/target-state/__tests__/validate.test.d.ts +0 -1
  149. package/dist/target-state/__tests__/validate.test.js +0 -78
  150. package/dist/technology-service/__tests__/validate.test.d.ts +0 -1
  151. package/dist/technology-service/__tests__/validate.test.js +0 -121
  152. package/dist/theme/__tests__/tokens.test.d.ts +0 -1
  153. package/dist/theme/__tests__/tokens.test.js +0 -159
  154. package/dist/webview/__tests__/entity-text-layout.test.d.ts +0 -1
  155. package/dist/webview/__tests__/entity-text-layout.test.js +0 -155
  156. package/dist/webview/__tests__/entry-notations.test.d.ts +0 -1
  157. package/dist/webview/__tests__/entry-notations.test.js +0 -62
  158. package/dist/webview/__tests__/entry.test.d.ts +0 -1
  159. package/dist/webview/__tests__/entry.test.js +0 -56
  160. package/dist/webview/__tests__/render-activities.test.d.ts +0 -1
  161. package/dist/webview/__tests__/render-activities.test.js +0 -91
  162. package/dist/webview/__tests__/render-blocks.test.d.ts +0 -1
  163. package/dist/webview/__tests__/render-blocks.test.js +0 -175
  164. package/dist/webview/__tests__/render-goals.test.d.ts +0 -1
  165. package/dist/webview/__tests__/render-goals.test.js +0 -120
  166. package/dist/webview/__tests__/render-process.test.d.ts +0 -1
  167. package/dist/webview/__tests__/render-process.test.js +0 -463
  168. package/dist/webview/__tests__/render-util.test.d.ts +0 -1
  169. package/dist/webview/__tests__/render-util.test.js +0 -54
  170. package/src/__tests__/edge-path.test.ts +0 -67
  171. package/src/__tests__/node-size-presets.test.ts +0 -50
  172. package/src/__tests__/scope.test.ts +0 -27
  173. package/src/__tests__/yaml-normalize.test.ts +0 -158
  174. package/src/activities/__tests__/cpm.test.ts +0 -164
  175. package/src/activities/__tests__/gantt.test.ts +0 -290
  176. package/src/activities/__tests__/layout.test.ts +0 -112
  177. package/src/activities/__tests__/validate.test.ts +0 -446
  178. package/src/activity-card/__tests__/example.test.ts +0 -83
  179. package/src/activity-card/__tests__/layout.test.ts +0 -162
  180. package/src/activity-card/__tests__/resolver.test.ts +0 -357
  181. package/src/activity-card/__tests__/validate.test.ts +0 -167
  182. package/src/actor/__tests__/validate.test.ts +0 -114
  183. package/src/applications/__tests__/validate.test.ts +0 -256
  184. package/src/assertion/__tests__/example.test.ts +0 -37
  185. package/src/assertion/__tests__/validate.test.ts +0 -142
  186. package/src/blocks/__tests__/layout.test.ts +0 -169
  187. package/src/blocks/__tests__/validate.test.ts +0 -260
  188. package/src/business-service/__tests__/validate.test.ts +0 -160
  189. package/src/capability-map/__tests__/CapabilityMapView.test.tsx +0 -232
  190. package/src/capability-map/__tests__/address.test.ts +0 -59
  191. package/src/capability-map/__tests__/dsm-layout.test.ts +0 -52
  192. package/src/capability-map/__tests__/dsm-mutations.test.ts +0 -141
  193. package/src/capability-map/__tests__/dsm-validate.test.ts +0 -65
  194. package/src/capability-map/__tests__/validate.test.ts +0 -238
  195. package/src/change/__tests__/validate.test.ts +0 -97
  196. package/src/codex/__tests__/example.test.ts +0 -40
  197. package/src/codex/__tests__/validate.test.ts +0 -84
  198. package/src/compliance/__tests__/canon-catalog.test.ts +0 -68
  199. package/src/compliance/__tests__/classify.test.ts +0 -64
  200. package/src/compliance/__tests__/confidence.test.ts +0 -98
  201. package/src/compliance/__tests__/coverage-metric.test.ts +0 -300
  202. package/src/compliance/__tests__/demo-scenario.test.ts +0 -273
  203. package/src/compliance/__tests__/example.test.ts +0 -57
  204. package/src/compliance/__tests__/gap-report.test.ts +0 -129
  205. package/src/compliance/__tests__/html.test.ts +0 -142
  206. package/src/compliance/__tests__/impact.test.ts +0 -1060
  207. package/src/compliance/__tests__/markdown.test.ts +0 -95
  208. package/src/compliance/__tests__/trace.test.ts +0 -157
  209. package/src/compliance/__tests__/view-resolution.test.ts +0 -80
  210. package/src/compliance/__tests__/views.test.ts +0 -64
  211. package/src/compliance-matrix/__tests__/build.test.ts +0 -200
  212. package/src/compliance-matrix/__tests__/example.test.ts +0 -57
  213. package/src/confidence/__tests__/score.test.ts +0 -254
  214. package/src/constraint/__tests__/example.test.ts +0 -19
  215. package/src/constraint/__tests__/validate.test.ts +0 -68
  216. package/src/factor/__tests__/validate.test.ts +0 -133
  217. package/src/fgca/__tests__/chain-table.test.ts +0 -172
  218. package/src/fgca/__tests__/layout.test.ts +0 -179
  219. package/src/fgca/__tests__/parse-canonical.test.ts +0 -296
  220. package/src/fgca/__tests__/preview-layout.test.ts +0 -124
  221. package/src/fgca/__tests__/resolver.test.ts +0 -209
  222. package/src/fgca/__tests__/validate.test.ts +0 -142
  223. package/src/goals/__tests__/GoalTreeView.test.tsx +0 -361
  224. package/src/goals/__tests__/layout.test.ts +0 -175
  225. package/src/goals/__tests__/mutations.test.ts +0 -153
  226. package/src/goals/__tests__/parse-canonical.test.ts +0 -147
  227. package/src/goals/__tests__/validate.test.ts +0 -202
  228. package/src/integration/__tests__/validate.test.ts +0 -203
  229. package/src/location/__tests__/validate.test.ts +0 -127
  230. package/src/node/__tests__/validate.test.ts +0 -118
  231. package/src/process-blueprint/__tests__/compliance-lane.test.ts +0 -320
  232. package/src/process-blueprint/__tests__/layout.test.ts +0 -240
  233. package/src/process-blueprint/__tests__/validate.test.ts +0 -310
  234. package/src/process-map/__tests__/validate.test.ts +0 -223
  235. package/src/products/__tests__/validate.test.ts +0 -239
  236. package/src/repo-validate/__tests__/validate-repo.test.ts +0 -699
  237. package/src/requirement/__tests__/example.test.ts +0 -24
  238. package/src/requirement/__tests__/validate.test.ts +0 -96
  239. package/src/scenarios/__tests__/validate.test.ts +0 -209
  240. package/src/stakeholder/__tests__/validate.test.ts +0 -105
  241. package/src/target-state/__tests__/validate.test.ts +0 -95
  242. package/src/technology-service/__tests__/validate.test.ts +0 -143
  243. package/src/theme/__tests__/tokens.test.ts +0 -185
  244. package/src/webview/__tests__/entity-text-layout.test.ts +0 -182
  245. package/src/webview/__tests__/entry-notations.test.ts +0 -77
  246. package/src/webview/__tests__/entry.test.ts +0 -64
  247. package/src/webview/__tests__/render-activities.test.ts +0 -100
  248. package/src/webview/__tests__/render-blocks.test.ts +0 -206
  249. package/src/webview/__tests__/render-goals.test.ts +0 -128
  250. package/src/webview/__tests__/render-process.test.ts +0 -538
  251. package/src/webview/__tests__/render-util.test.ts +0 -66
@@ -1,199 +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 { validateProcessMap } from '../validate.js';
6
- const EXAMPLES_DIR = path.resolve(process.cwd(), '..', '..', 'tests', 'fixtures', 'notation-corpus', 'process-map');
7
- const VALID_MAP = {
8
- notation: 'process-map',
9
- process_map: {
10
- id: 'PM-ENT-001',
11
- name: 'Enterprise Process Landscape',
12
- updated_at: '2026-05-08',
13
- groups: [
14
- {
15
- id: 'GRP-OPERATING',
16
- name: 'Operating Processes',
17
- type: 'operating',
18
- processes: [
19
- { process_id: 'PROC-ORD-FULFILL-001', name: 'Order Fulfilment', status: 'Active', maturity: 2 },
20
- { process_id: 'PROC-CUST-ONBOARD-001', name: 'Customer Onboarding', status: 'Draft' },
21
- ],
22
- },
23
- {
24
- id: 'GRP-SUPPORTING',
25
- name: 'Supporting Processes',
26
- type: 'supporting',
27
- processes: [
28
- { process_id: 'PROC-HR-RECRUIT-001', name: 'Recruitment', status: 'Active' },
29
- ],
30
- },
31
- ],
32
- },
33
- };
34
- describe('validateProcessMap', () => {
35
- it('passes on valid input', () => {
36
- const r = validateProcessMap(VALID_MAP);
37
- expect(r.valid).toBe(true);
38
- expect(r.errors).toHaveLength(0);
39
- });
40
- it('PMAP-001: rejects non-object input', () => {
41
- const r = validateProcessMap(null);
42
- expect(r.valid).toBe(false);
43
- expect(r.errors[0].code).toBe('PMAP-001');
44
- });
45
- it('PMAP-001: rejects missing notation', () => {
46
- const { notation: _, ...rest } = VALID_MAP;
47
- const r = validateProcessMap(rest);
48
- expect(r.errors.some(e => e.code === 'PMAP-001')).toBe(true);
49
- });
50
- it('PMAP-001: rejects wrong notation value', () => {
51
- const r = validateProcessMap({ ...VALID_MAP, notation: 'goals' });
52
- expect(r.errors.some(e => e.code === 'PMAP-001')).toBe(true);
53
- });
54
- it('PMAP-002: rejects missing process_map', () => {
55
- const r = validateProcessMap({ notation: 'process-map' });
56
- expect(r.errors.some(e => e.code === 'PMAP-002')).toBe(true);
57
- });
58
- it('PMAP-002: rejects missing id/name/updated_at', () => {
59
- const r = validateProcessMap({ notation: 'process-map', process_map: { groups: [] } });
60
- expect(r.errors.filter(e => e.code === 'PMAP-002').length).toBeGreaterThanOrEqual(3);
61
- });
62
- it('PMAP-002: rejects non-array groups', () => {
63
- const map = { ...VALID_MAP.process_map, groups: 'oops' };
64
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
65
- expect(r.errors.some(e => e.code === 'PMAP-002')).toBe(true);
66
- });
67
- it('PMAP-003: rejects group missing id/name/type', () => {
68
- const map = { ...VALID_MAP.process_map, groups: [{ processes: [] }] };
69
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
70
- expect(r.errors.filter(e => e.code === 'PMAP-003').length).toBeGreaterThanOrEqual(3);
71
- });
72
- it('PMAP-004: rejects invalid group type', () => {
73
- const map = {
74
- ...VALID_MAP.process_map,
75
- groups: [{ id: 'g1', name: 'X', type: 'random', processes: [] }],
76
- };
77
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
78
- expect(r.errors.some(e => e.code === 'PMAP-004')).toBe(true);
79
- });
80
- it('PMAP-004: accepts all valid group types', () => {
81
- for (const type of ['operating', 'supporting', 'management']) {
82
- const map = {
83
- ...VALID_MAP.process_map,
84
- groups: [{ id: 'g1', name: 'X', type, processes: [] }],
85
- };
86
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
87
- expect(r.errors.some(e => e.code === 'PMAP-004')).toBe(false);
88
- }
89
- });
90
- it('PMAP-005: rejects process missing process_id/name/status', () => {
91
- const map = {
92
- ...VALID_MAP.process_map,
93
- groups: [{ id: 'g1', name: 'G', type: 'operating', processes: [{}] }],
94
- };
95
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
96
- expect(r.errors.filter(e => e.code === 'PMAP-005').length).toBeGreaterThanOrEqual(3);
97
- });
98
- it('PMAP-006: rejects invalid status', () => {
99
- const map = {
100
- ...VALID_MAP.process_map,
101
- groups: [{ id: 'g1', name: 'G', type: 'operating', processes: [
102
- { process_id: 'p1', name: 'X', status: 'Retired' },
103
- ] }],
104
- };
105
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
106
- expect(r.errors.some(e => e.code === 'PMAP-006')).toBe(true);
107
- });
108
- it('PMAP-007: rejects out-of-range maturity', () => {
109
- const map = {
110
- ...VALID_MAP.process_map,
111
- groups: [{ id: 'g1', name: 'G', type: 'operating', processes: [
112
- { process_id: 'p1', name: 'X', status: 'Active', maturity: 6 },
113
- ] }],
114
- };
115
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
116
- expect(r.errors.some(e => e.code === 'PMAP-007')).toBe(true);
117
- });
118
- it('PMAP-007: accepts maturity 1-5', () => {
119
- for (const maturity of [1, 2, 3, 4, 5]) {
120
- const map = {
121
- ...VALID_MAP.process_map,
122
- groups: [{ id: 'g1', name: 'G', type: 'operating', processes: [
123
- { process_id: 'p1', name: 'X', status: 'Active', maturity },
124
- ] }],
125
- };
126
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
127
- expect(r.errors.some(e => e.code === 'PMAP-007')).toBe(false);
128
- }
129
- });
130
- it('PMAP-008: rejects malformed updated_at', () => {
131
- const map = { ...VALID_MAP.process_map, updated_at: '13-05-2026' };
132
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
133
- expect(r.errors.some(e => e.code === 'PMAP-008')).toBe(true);
134
- });
135
- it('PMAP-009: rejects duplicate process_id across groups', () => {
136
- const map = {
137
- ...VALID_MAP.process_map,
138
- groups: [
139
- { id: 'g1', name: 'A', type: 'operating', processes: [{ process_id: 'P1', name: 'X', status: 'Active' }] },
140
- { id: 'g2', name: 'B', type: 'supporting', processes: [{ process_id: 'P1', name: 'Y', status: 'Active' }] },
141
- ],
142
- };
143
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
144
- expect(r.errors.some(e => e.code === 'PMAP-009')).toBe(true);
145
- });
146
- it('PMAP-010: rejects duplicate group id', () => {
147
- const map = {
148
- ...VALID_MAP.process_map,
149
- groups: [
150
- { id: 'gdup', name: 'A', type: 'operating', processes: [] },
151
- { id: 'gdup', name: 'B', type: 'supporting', processes: [] },
152
- ],
153
- };
154
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
155
- expect(r.errors.some(e => e.code === 'PMAP-010')).toBe(true);
156
- });
157
- it('accepts empty groups array', () => {
158
- const map = { ...VALID_MAP.process_map, groups: [] };
159
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
160
- expect(r.valid).toBe(true);
161
- });
162
- it('accepts group with no processes field', () => {
163
- const map = {
164
- ...VALID_MAP.process_map,
165
- groups: [{ id: 'g1', name: 'G', type: 'operating' }],
166
- };
167
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
168
- expect(r.valid).toBe(true);
169
- });
170
- // Pre-release blocker regression (orchestrator review 2026-05-21).
171
- it('[blocker] tolerates a null element in groups[] without throwing', () => {
172
- const map = { ...VALID_MAP.process_map, groups: [null] };
173
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
174
- expect(r.valid).toBe(false);
175
- expect(r.errors.some(e => e.code === 'PMAP-003')).toBe(true);
176
- });
177
- it('[blocker] tolerates a null element in processes[] without throwing', () => {
178
- const map = {
179
- ...VALID_MAP.process_map,
180
- groups: [{ id: 'g1', name: 'G', type: 'operating', processes: [null] }],
181
- };
182
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
183
- expect(r.valid).toBe(false);
184
- expect(r.errors.some(e => e.code === 'PMAP-005')).toBe(true);
185
- });
186
- });
187
- describe('process-map examples (regression)', () => {
188
- const files = fs.readdirSync(EXAMPLES_DIR).filter(f => f.endsWith('.yaml'));
189
- expect(files.length).toBeGreaterThan(0);
190
- for (const file of files) {
191
- it(`validates tests/fixtures/notation-corpus/process-map/${file}`, () => {
192
- const text = fs.readFileSync(path.join(EXAMPLES_DIR, file), 'utf8');
193
- const parsed = yaml.load(text);
194
- const r = validateProcessMap(parsed);
195
- expect(r.errors).toEqual([]);
196
- expect(r.valid).toBe(true);
197
- });
198
- }
199
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,210 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { validateProductsCatalogue } from '../validate.js';
3
- const VALID_CATALOGUE = {
4
- notation: 'products',
5
- products_catalogue: {
6
- id: 'cat-2026',
7
- name: 'Portfolio 2026',
8
- updated_at: '2026-05-13',
9
- products: [
10
- {
11
- product_id: 'prod-001',
12
- name: 'Analytics Platform',
13
- type: 'platform',
14
- status: 'Active',
15
- domain: 'Data',
16
- maturity: 3,
17
- },
18
- {
19
- product_id: 'prod-002',
20
- name: 'HR Service',
21
- type: 'service',
22
- status: 'Draft',
23
- },
24
- ],
25
- },
26
- };
27
- describe('validateProductsCatalogue', () => {
28
- it('passes on valid input', () => {
29
- const r = validateProductsCatalogue(VALID_CATALOGUE);
30
- expect(r.valid).toBe(true);
31
- expect(r.errors).toHaveLength(0);
32
- });
33
- it('PROD-001: rejects non-object input', () => {
34
- const r = validateProductsCatalogue(null);
35
- expect(r.valid).toBe(false);
36
- expect(r.errors[0].code).toBe('PROD-001');
37
- });
38
- it('PROD-001: rejects missing notation field', () => {
39
- const { notation: _, ...rest } = VALID_CATALOGUE;
40
- const r = validateProductsCatalogue(rest);
41
- expect(r.valid).toBe(false);
42
- expect(r.errors.some(e => e.code === 'PROD-001')).toBe(true);
43
- });
44
- it('PROD-001: rejects wrong notation value', () => {
45
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, notation: 'goals' });
46
- expect(r.valid).toBe(false);
47
- expect(r.errors.some(e => e.code === 'PROD-001')).toBe(true);
48
- });
49
- it('PROD-002: rejects missing products_catalogue', () => {
50
- const r = validateProductsCatalogue({ notation: 'products' });
51
- expect(r.valid).toBe(false);
52
- expect(r.errors.some(e => e.code === 'PROD-002')).toBe(true);
53
- });
54
- it('PROD-002: rejects missing catalogue id', () => {
55
- const cat = { ...VALID_CATALOGUE.products_catalogue, id: '' };
56
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
57
- expect(r.valid).toBe(false);
58
- expect(r.errors.some(e => e.code === 'PROD-002' && e.message.includes('id'))).toBe(true);
59
- });
60
- it('PROD-002: rejects missing catalogue name', () => {
61
- const cat = { ...VALID_CATALOGUE.products_catalogue, name: ' ' };
62
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
63
- expect(r.valid).toBe(false);
64
- expect(r.errors.some(e => e.code === 'PROD-002' && e.message.includes('name'))).toBe(true);
65
- });
66
- it('PROD-002: rejects missing updated_at', () => {
67
- const { updated_at: _, ...cat } = VALID_CATALOGUE.products_catalogue;
68
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
69
- expect(r.valid).toBe(false);
70
- expect(r.errors.some(e => e.code === 'PROD-002' && e.message.includes('updated_at'))).toBe(true);
71
- });
72
- it('PROD-002: rejects non-array products', () => {
73
- const cat = { ...VALID_CATALOGUE.products_catalogue, products: 'not-an-array' };
74
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
75
- expect(r.valid).toBe(false);
76
- expect(r.errors.some(e => e.code === 'PROD-002')).toBe(true);
77
- });
78
- it('PROD-003: rejects missing product_id', () => {
79
- const products = [{ name: 'X', type: 'service', status: 'Active' }];
80
- const cat = { ...VALID_CATALOGUE.products_catalogue, products };
81
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
82
- expect(r.valid).toBe(false);
83
- expect(r.errors.some(e => e.code === 'PROD-003' && e.message.includes('product_id'))).toBe(true);
84
- });
85
- it('PROD-003: rejects missing name', () => {
86
- const products = [{ product_id: 'p1', name: '', type: 'service', status: 'Active' }];
87
- const cat = { ...VALID_CATALOGUE.products_catalogue, products };
88
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
89
- expect(r.valid).toBe(false);
90
- expect(r.errors.some(e => e.code === 'PROD-003' && e.message.includes('name'))).toBe(true);
91
- });
92
- it('PROD-003: rejects missing type', () => {
93
- const products = [{ product_id: 'p1', name: 'X', status: 'Active' }];
94
- const cat = { ...VALID_CATALOGUE.products_catalogue, products };
95
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
96
- expect(r.valid).toBe(false);
97
- expect(r.errors.some(e => e.code === 'PROD-003' && e.message.includes('type'))).toBe(true);
98
- });
99
- it('PROD-003: rejects missing status', () => {
100
- const products = [{ product_id: 'p1', name: 'X', type: 'service' }];
101
- const cat = { ...VALID_CATALOGUE.products_catalogue, products };
102
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
103
- expect(r.valid).toBe(false);
104
- expect(r.errors.some(e => e.code === 'PROD-003' && e.message.includes('status'))).toBe(true);
105
- });
106
- it('PROD-004: rejects invalid type', () => {
107
- const products = [{ product_id: 'p1', name: 'X', type: 'hardware', status: 'Active' }];
108
- const cat = { ...VALID_CATALOGUE.products_catalogue, products };
109
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
110
- expect(r.valid).toBe(false);
111
- expect(r.errors.some(e => e.code === 'PROD-004')).toBe(true);
112
- });
113
- it('PROD-004: accepts all valid types', () => {
114
- for (const type of ['digital_product', 'service', 'platform', 'bundle']) {
115
- const products = [{ product_id: 'p1', name: 'X', type, status: 'Active' }];
116
- const cat = { ...VALID_CATALOGUE.products_catalogue, products };
117
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
118
- expect(r.errors.some(e => e.code === 'PROD-004')).toBe(false);
119
- }
120
- });
121
- it('PROD-005: rejects invalid status', () => {
122
- const products = [{ product_id: 'p1', name: 'X', type: 'service', status: 'Active2' }];
123
- const cat = { ...VALID_CATALOGUE.products_catalogue, products };
124
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
125
- expect(r.valid).toBe(false);
126
- expect(r.errors.some(e => e.code === 'PROD-005')).toBe(true);
127
- });
128
- it('PROD-005: accepts all valid statuses', () => {
129
- for (const status of ['Draft', 'Active', 'Deprecated']) {
130
- const products = [{ product_id: 'p1', name: 'X', type: 'service', status }];
131
- const cat = { ...VALID_CATALOGUE.products_catalogue, products };
132
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
133
- expect(r.errors.some(e => e.code === 'PROD-005')).toBe(false);
134
- }
135
- });
136
- it('PROD-006: rejects maturity < 1', () => {
137
- const products = [{ product_id: 'p1', name: 'X', type: 'service', status: 'Active', maturity: 0 }];
138
- const cat = { ...VALID_CATALOGUE.products_catalogue, products };
139
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
140
- expect(r.valid).toBe(false);
141
- expect(r.errors.some(e => e.code === 'PROD-006')).toBe(true);
142
- });
143
- it('PROD-006: rejects maturity > 5', () => {
144
- const products = [{ product_id: 'p1', name: 'X', type: 'service', status: 'Active', maturity: 6 }];
145
- const cat = { ...VALID_CATALOGUE.products_catalogue, products };
146
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
147
- expect(r.valid).toBe(false);
148
- expect(r.errors.some(e => e.code === 'PROD-006')).toBe(true);
149
- });
150
- it('PROD-006: rejects non-integer maturity', () => {
151
- const products = [{ product_id: 'p1', name: 'X', type: 'service', status: 'Active', maturity: 2.5 }];
152
- const cat = { ...VALID_CATALOGUE.products_catalogue, products };
153
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
154
- expect(r.valid).toBe(false);
155
- expect(r.errors.some(e => e.code === 'PROD-006')).toBe(true);
156
- });
157
- it('PROD-006: accepts valid maturity range 1-5', () => {
158
- for (const maturity of [1, 2, 3, 4, 5]) {
159
- const products = [{ product_id: 'p1', name: 'X', type: 'service', status: 'Active', maturity }];
160
- const cat = { ...VALID_CATALOGUE.products_catalogue, products };
161
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
162
- expect(r.errors.some(e => e.code === 'PROD-006')).toBe(false);
163
- }
164
- });
165
- it('PROD-007: rejects malformed updated_at', () => {
166
- const cat = { ...VALID_CATALOGUE.products_catalogue, updated_at: '13-05-2026' };
167
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
168
- expect(r.valid).toBe(false);
169
- expect(r.errors.some(e => e.code === 'PROD-007')).toBe(true);
170
- });
171
- it('PROD-007: accepts YYYY-MM-DD format', () => {
172
- const cat = { ...VALID_CATALOGUE.products_catalogue, updated_at: '2026-01-01' };
173
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
174
- expect(r.errors.some(e => e.code === 'PROD-007')).toBe(false);
175
- });
176
- it('PROD-008: rejects duplicate product_id', () => {
177
- const products = [
178
- { product_id: 'p1', name: 'X', type: 'service', status: 'Active' },
179
- { product_id: 'p1', name: 'Y', type: 'platform', status: 'Draft' },
180
- ];
181
- const cat = { ...VALID_CATALOGUE.products_catalogue, products };
182
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
183
- expect(r.valid).toBe(false);
184
- expect(r.errors.some(e => e.code === 'PROD-008')).toBe(true);
185
- });
186
- it('accepts empty products array', () => {
187
- const cat = { ...VALID_CATALOGUE.products_catalogue, products: [] };
188
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
189
- expect(r.valid).toBe(true);
190
- });
191
- it('accepts optional fields when absent', () => {
192
- const products = [{ product_id: 'p1', name: 'X', type: 'service', status: 'Active' }];
193
- const cat = { ...VALID_CATALOGUE.products_catalogue, products };
194
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
195
- expect(r.valid).toBe(true);
196
- });
197
- // Pre-release blocker regression (orchestrator review 2026-05-21).
198
- it('[blocker] tolerates a null element in products[] without throwing', () => {
199
- const cat = { ...VALID_CATALOGUE.products_catalogue, products: [null] };
200
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
201
- expect(r.valid).toBe(false);
202
- expect(r.errors.some(e => e.code === 'PROD-003')).toBe(true);
203
- });
204
- it('[blocker] tolerates a string element in products[] without throwing', () => {
205
- const cat = { ...VALID_CATALOGUE.products_catalogue, products: ['x'] };
206
- const r = validateProductsCatalogue({ ...VALID_CATALOGUE, products_catalogue: cat });
207
- expect(r.valid).toBe(false);
208
- expect(r.errors.some(e => e.code === 'PROD-003')).toBe(true);
209
- });
210
- });
@@ -1 +0,0 @@
1
- export {};