@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,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 {};