@transitrix/diagrams 1.8.4 → 1.8.7

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