@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,196 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { layoutProcessBlueprint } from '../layout.js';
3
- function build(file) {
4
- return {
5
- notation: 'process-blueprint',
6
- process_blueprint: {
7
- id: 'PROCESS_BLUEPRINT-T-1',
8
- name: 'Test',
9
- stages: [],
10
- ...file,
11
- },
12
- };
13
- }
14
- describe('layoutProcessBlueprint', () => {
15
- it('lays out stage headers in input order across the legend offset', () => {
16
- const layout = layoutProcessBlueprint(build({
17
- stages: [
18
- { id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' },
19
- { id: 'STAGE-2', name: 'B', goal: 'g', result: 'r' },
20
- { id: 'STAGE-3', name: 'C', goal: 'g', result: 'r' },
21
- ],
22
- }));
23
- expect(layout.stageHeaders).toHaveLength(3);
24
- expect(layout.stageHeaders[0].x).toBe(layout.legendColumnWidth);
25
- expect(layout.stageHeaders[1].x).toBe(layout.legendColumnWidth + layout.stageColumnWidth);
26
- expect(layout.stageHeaders[2].x).toBe(layout.legendColumnWidth + 2 * layout.stageColumnWidth);
27
- expect(layout.stageHeaders[0].name).toBe('A');
28
- });
29
- it('produces goal and result cells aligned under each stage column', () => {
30
- const layout = layoutProcessBlueprint(build({
31
- stages: [
32
- { id: 'STAGE-1', name: 'A', goal: 'gA', result: 'rA' },
33
- { id: 'STAGE-2', name: 'B', goal: 'gB', result: 'rB' },
34
- ],
35
- }));
36
- expect(layout.goalCells.map(c => c.text)).toEqual(['gA', 'gB']);
37
- expect(layout.resultCells.map(c => c.text)).toEqual(['rA', 'rB']);
38
- expect(layout.goalCells[0].y).toBeLessThan(layout.resultCells[0].y);
39
- expect(layout.goalCells[0].x).toBe(layout.stageHeaders[0].x);
40
- });
41
- it('omits aspect rows for categories without any entries', () => {
42
- const layout = layoutProcessBlueprint(build({
43
- stages: [{ id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' }],
44
- }));
45
- expect(layout.aspectRows).toHaveLength(0);
46
- });
47
- it('merges consecutive stages into a single spanning pill', () => {
48
- const layout = layoutProcessBlueprint(build({
49
- stages: [
50
- { id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' },
51
- { id: 'STAGE-2', name: 'B', goal: 'g', result: 'r' },
52
- { id: 'STAGE-3', name: 'C', goal: 'g', result: 'r' },
53
- ],
54
- systems: [
55
- { id: 'APPLICATION-OMS-1', name: 'OMS', stages: ['STAGE-1', 'STAGE-2', 'STAGE-3'] },
56
- ],
57
- }));
58
- expect(layout.aspectRows).toHaveLength(1);
59
- const row = layout.aspectRows[0];
60
- expect(row.category).toBe('systems');
61
- expect(row.pills).toHaveLength(1);
62
- expect(row.pills[0].startStageIndex).toBe(0);
63
- expect(row.pills[0].endStageIndex).toBe(2);
64
- expect(row.pills[0].width).toBeGreaterThan(layout.stageColumnWidth);
65
- });
66
- it('splits non-consecutive stages into separate pills', () => {
67
- const layout = layoutProcessBlueprint(build({
68
- stages: [
69
- { id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' },
70
- { id: 'STAGE-2', name: 'B', goal: 'g', result: 'r' },
71
- { id: 'STAGE-3', name: 'C', goal: 'g', result: 'r' },
72
- { id: 'STAGE-4', name: 'D', goal: 'g', result: 'r' },
73
- ],
74
- systems: [
75
- { id: 'APPLICATION-X-1', name: 'X', stages: ['STAGE-1', 'STAGE-3', 'STAGE-4'] },
76
- ],
77
- }));
78
- const pills = layout.aspectRows[0].pills;
79
- expect(pills).toHaveLength(2);
80
- expect(pills[0].startStageIndex).toBe(0);
81
- expect(pills[0].endStageIndex).toBe(0);
82
- expect(pills[1].startStageIndex).toBe(2);
83
- expect(pills[1].endStageIndex).toBe(3);
84
- });
85
- it('stacks overlapping pills into vertical slots inside the same row', () => {
86
- const layout = layoutProcessBlueprint(build({
87
- stages: [
88
- { id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' },
89
- { id: 'STAGE-2', name: 'B', goal: 'g', result: 'r' },
90
- ],
91
- systems: [
92
- { id: 'APPLICATION-A-1', name: 'A', stages: ['STAGE-1', 'STAGE-2'] },
93
- { id: 'APPLICATION-B-1', name: 'B', stages: ['STAGE-1'] },
94
- ],
95
- }));
96
- const row = layout.aspectRows[0];
97
- expect(row.pills).toHaveLength(2);
98
- // The two pills overlap at STAGE-1, so they should sit at different y.
99
- expect(row.pills[0].y).not.toBe(row.pills[1].y);
100
- // Row height must be tall enough for two stacked pills.
101
- expect(row.height).toBeGreaterThan(row.pills[0].height);
102
- });
103
- it('preserves the fixed category order: systems, actors, equipment, information_entities', () => {
104
- const layout = layoutProcessBlueprint(build({
105
- stages: [{ id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' }],
106
- information_entities: [{ name: 'Doc', stages: ['STAGE-1'] }],
107
- actors: [{ id: 'ROLE-X-1', name: 'X', stages: ['STAGE-1'] }],
108
- systems: [{ id: 'APPLICATION-X-1', name: 'X', stages: ['STAGE-1'] }],
109
- equipment: [{ name: 'Scanner', stages: ['STAGE-1'] }],
110
- }));
111
- expect(layout.aspectRows.map(r => r.category)).toEqual([
112
- 'systems',
113
- 'actors',
114
- 'equipment',
115
- 'information_entities',
116
- ]);
117
- });
118
- it('builds the legend in row order: goal, result, then aspect categories', () => {
119
- const layout = layoutProcessBlueprint(build({
120
- stages: [{ id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' }],
121
- systems: [{ id: 'APPLICATION-X-1', name: 'X', stages: ['STAGE-1'] }],
122
- }));
123
- expect(layout.legend.map(l => l.kind)).toEqual(['goal', 'result', 'aspect']);
124
- expect(layout.legend[2].category).toBe('systems');
125
- });
126
- it('total bounds cover the legend column plus every stage column', () => {
127
- const layout = layoutProcessBlueprint(build({
128
- stages: [
129
- { id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' },
130
- { id: 'STAGE-2', name: 'B', goal: 'g', result: 'r' },
131
- ],
132
- }));
133
- expect(layout.bounds.width).toBe(layout.legendColumnWidth + 2 * layout.stageColumnWidth);
134
- expect(layout.bounds.height).toBeGreaterThan(0);
135
- });
136
- it('ignores aspect entries that reference undeclared stages', () => {
137
- const layout = layoutProcessBlueprint(build({
138
- stages: [{ id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' }],
139
- systems: [
140
- { id: 'APPLICATION-X-1', name: 'X', stages: ['STAGE-1', 'STAGE-999'] },
141
- ],
142
- }));
143
- const pills = layout.aspectRows[0].pills;
144
- expect(pills).toHaveLength(1);
145
- expect(pills[0].startStageIndex).toBe(0);
146
- expect(pills[0].endStageIndex).toBe(0);
147
- });
148
- it('honours overridden LayoutOptions', () => {
149
- const layout = layoutProcessBlueprint(build({
150
- stages: [
151
- { id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' },
152
- { id: 'STAGE-2', name: 'B', goal: 'g', result: 'r' },
153
- ],
154
- }), { legendColumnWidth: 200, stageColumnWidth: 300 });
155
- expect(layout.legendColumnWidth).toBe(200);
156
- expect(layout.stageColumnWidth).toBe(300);
157
- expect(layout.stageHeaders[1].x).toBe(200 + 300);
158
- });
159
- describe('visibleAspects', () => {
160
- const FILE_WITH_ALL = build({
161
- stages: [{ id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' }],
162
- systems: [{ name: 'OMS', stages: ['STAGE-1'] }],
163
- actors: [{ name: 'Ops', stages: ['STAGE-1'] }],
164
- equipment: [{ name: 'Printer', stages: ['STAGE-1'] }],
165
- });
166
- it('shows all categories when visibleAspects is not set', () => {
167
- const layout = layoutProcessBlueprint(FILE_WITH_ALL);
168
- expect(layout.aspectRows.map(r => r.category)).toEqual(expect.arrayContaining(['systems', 'actors', 'equipment']));
169
- expect(layout.aspectRows).toHaveLength(3);
170
- });
171
- it('limits rows to those in visibleAspects', () => {
172
- const layout = layoutProcessBlueprint(FILE_WITH_ALL, {
173
- visibleAspects: ['systems'],
174
- });
175
- expect(layout.aspectRows).toHaveLength(1);
176
- expect(layout.aspectRows[0].category).toBe('systems');
177
- });
178
- it('suppresses all aspect rows when visibleAspects is empty', () => {
179
- const layout = layoutProcessBlueprint(FILE_WITH_ALL, { visibleAspects: [] });
180
- expect(layout.aspectRows).toHaveLength(0);
181
- });
182
- it('preserves the canonical ASPECT_CATEGORIES order within the filtered set', () => {
183
- const layout = layoutProcessBlueprint(FILE_WITH_ALL, {
184
- visibleAspects: ['equipment', 'systems'],
185
- });
186
- expect(layout.aspectRows.map(r => r.category)).toEqual(['systems', 'equipment']);
187
- });
188
- it('ignores categories in visibleAspects that have no data', () => {
189
- const layout = layoutProcessBlueprint(FILE_WITH_ALL, {
190
- visibleAspects: ['systems', 'information_entities'],
191
- });
192
- expect(layout.aspectRows).toHaveLength(1);
193
- expect(layout.aspectRows[0].category).toBe('systems');
194
- });
195
- });
196
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,280 +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 { validateProcessBlueprint } from '../validate.js';
6
- const EXAMPLES_DIR = path.resolve(process.cwd(), '..', '..', 'tests', 'fixtures', 'notation-corpus', 'process-blueprint');
7
- const VALID_BLUEPRINT = {
8
- notation: 'process-blueprint',
9
- spec_version: '0.1',
10
- process_blueprint: {
11
- id: 'PROCESS_BLUEPRINT-FULFIL-1',
12
- name: 'Order fulfilment blueprint',
13
- stages: [
14
- { id: 'STAGE-1', name: 'Receive', goal: 'Capture order', result: 'Validated order' },
15
- { id: 'STAGE-2', name: 'Pack', goal: 'Assemble', result: 'Packed shipment' },
16
- { id: 'STAGE-3', name: 'Ship', goal: 'Hand to carrier', result: 'In transit' },
17
- ],
18
- systems: [
19
- { id: 'APPLICATION-OMS-1', name: 'OMS', stages: ['STAGE-1', 'STAGE-2', 'STAGE-3'] },
20
- ],
21
- actors: [
22
- { id: 'ROLE-WAREHOUSE-1', name: 'Warehouse op', stages: ['STAGE-2', 'STAGE-3'] },
23
- ],
24
- equipment: [
25
- { name: 'Barcode scanner', stages: ['STAGE-2', 'STAGE-3'] },
26
- ],
27
- information_entities: [
28
- { name: 'Customer order', stages: ['STAGE-1', 'STAGE-2', 'STAGE-3'] },
29
- ],
30
- },
31
- };
32
- describe('validateProcessBlueprint', () => {
33
- it('passes on a valid blueprint', () => {
34
- const r = validateProcessBlueprint(VALID_BLUEPRINT);
35
- expect(r.valid).toBe(true);
36
- expect(r.errors).toHaveLength(0);
37
- });
38
- it('BP-001: rejects non-object input', () => {
39
- expect(validateProcessBlueprint(null).valid).toBe(false);
40
- expect(validateProcessBlueprint(null).errors[0].code).toBe('BP-001');
41
- expect(validateProcessBlueprint('string').errors[0].code).toBe('BP-001');
42
- });
43
- it('BP-001: rejects missing process_blueprint root key', () => {
44
- const r = validateProcessBlueprint({ notation: 'process-blueprint' });
45
- expect(r.errors.some(e => e.code === 'BP-001')).toBe(true);
46
- });
47
- it('BP-001: rejects wrong notation value', () => {
48
- const r = validateProcessBlueprint({ ...VALID_BLUEPRINT, notation: 'goals' });
49
- expect(r.errors.some(e => e.code === 'BP-001')).toBe(true);
50
- });
51
- it('BP-001: tolerates a missing notation field (header check is contract-level)', () => {
52
- const { notation: _, ...rest } = VALID_BLUEPRINT;
53
- const r = validateProcessBlueprint(rest);
54
- expect(r.errors.some(e => e.code === 'BP-001')).toBe(false);
55
- });
56
- it('BP-002: rejects missing id', () => {
57
- const r = validateProcessBlueprint({
58
- ...VALID_BLUEPRINT,
59
- process_blueprint: { ...VALID_BLUEPRINT.process_blueprint, id: '' },
60
- });
61
- expect(r.errors.some(e => e.code === 'BP-002')).toBe(true);
62
- });
63
- it('BP-002: rejects id that does not match PROCESS_BLUEPRINT grammar', () => {
64
- const r = validateProcessBlueprint({
65
- ...VALID_BLUEPRINT,
66
- process_blueprint: { ...VALID_BLUEPRINT.process_blueprint, id: 'PB-1' },
67
- });
68
- expect(r.errors.some(e => e.code === 'BP-002')).toBe(true);
69
- });
70
- it('BP-003: rejects missing name', () => {
71
- const r = validateProcessBlueprint({
72
- ...VALID_BLUEPRINT,
73
- process_blueprint: { ...VALID_BLUEPRINT.process_blueprint, name: '' },
74
- });
75
- expect(r.errors.some(e => e.code === 'BP-003')).toBe(true);
76
- });
77
- it('BP-004: rejects missing stages', () => {
78
- const { stages: _, ...rest } = VALID_BLUEPRINT.process_blueprint;
79
- const r = validateProcessBlueprint({ ...VALID_BLUEPRINT, process_blueprint: rest });
80
- expect(r.errors.some(e => e.code === 'BP-004')).toBe(true);
81
- });
82
- it('BP-004: rejects empty stages array', () => {
83
- const r = validateProcessBlueprint({
84
- ...VALID_BLUEPRINT,
85
- process_blueprint: { ...VALID_BLUEPRINT.process_blueprint, stages: [] },
86
- });
87
- expect(r.errors.some(e => e.code === 'BP-004')).toBe(true);
88
- });
89
- it('BP-005: rejects stage missing goal', () => {
90
- const r = validateProcessBlueprint({
91
- ...VALID_BLUEPRINT,
92
- process_blueprint: {
93
- ...VALID_BLUEPRINT.process_blueprint,
94
- stages: [{ id: 'STAGE-1', name: 'X', goal: '', result: 'R' }],
95
- },
96
- });
97
- expect(r.errors.some(e => e.code === 'BP-005' && /goal/.test(e.message))).toBe(true);
98
- });
99
- it('BP-005: rejects stage missing result', () => {
100
- const r = validateProcessBlueprint({
101
- ...VALID_BLUEPRINT,
102
- process_blueprint: {
103
- ...VALID_BLUEPRINT.process_blueprint,
104
- stages: [{ id: 'STAGE-1', name: 'X', goal: 'G', result: '' }],
105
- },
106
- });
107
- expect(r.errors.some(e => e.code === 'BP-005' && /result/.test(e.message))).toBe(true);
108
- });
109
- it('BP-006: rejects duplicate stage ids', () => {
110
- const r = validateProcessBlueprint({
111
- ...VALID_BLUEPRINT,
112
- process_blueprint: {
113
- ...VALID_BLUEPRINT.process_blueprint,
114
- stages: [
115
- { id: 'STAGE-1', name: 'A', goal: 'G', result: 'R' },
116
- { id: 'STAGE-1', name: 'B', goal: 'G', result: 'R' },
117
- ],
118
- },
119
- });
120
- expect(r.errors.some(e => e.code === 'BP-006' && /Duplicate/.test(e.message))).toBe(true);
121
- });
122
- it('BP-006: treats ids that differ only in surrounding whitespace as duplicates', () => {
123
- const r = validateProcessBlueprint({
124
- ...VALID_BLUEPRINT,
125
- process_blueprint: {
126
- ...VALID_BLUEPRINT.process_blueprint,
127
- stages: [
128
- { id: 'STAGE-1', name: 'A', goal: 'G', result: 'R' },
129
- { id: 'STAGE-1 ', name: 'B', goal: 'G', result: 'R' },
130
- ],
131
- },
132
- });
133
- expect(r.errors.some(e => e.code === 'BP-006' && /Duplicate/.test(e.message))).toBe(true);
134
- });
135
- it('BP-008: tolerates whitespace around aspect stage refs (matches trimmed stage ids)', () => {
136
- const r = validateProcessBlueprint({
137
- ...VALID_BLUEPRINT,
138
- process_blueprint: {
139
- ...VALID_BLUEPRINT.process_blueprint,
140
- stages: [{ id: 'STAGE-1', name: 'A', goal: 'G', result: 'R' }],
141
- systems: [{ id: 'APPLICATION-X-1', name: 'X', stages: [' STAGE-1 '] }],
142
- actors: undefined,
143
- equipment: undefined,
144
- information_entities: undefined,
145
- },
146
- });
147
- expect(r.errors.some(e => e.code === 'BP-008')).toBe(false);
148
- });
149
- it('BP-006: rejects stage id that does not match STAGE grammar', () => {
150
- const r = validateProcessBlueprint({
151
- ...VALID_BLUEPRINT,
152
- process_blueprint: {
153
- ...VALID_BLUEPRINT.process_blueprint,
154
- stages: [{ id: 'STG-1', name: 'A', goal: 'G', result: 'R' }],
155
- },
156
- });
157
- expect(r.errors.some(e => e.code === 'BP-006')).toBe(true);
158
- });
159
- it('BP-007: rejects aspect entry missing name', () => {
160
- const r = validateProcessBlueprint({
161
- ...VALID_BLUEPRINT,
162
- process_blueprint: {
163
- ...VALID_BLUEPRINT.process_blueprint,
164
- systems: [{ name: '', stages: ['STAGE-1'] }],
165
- },
166
- });
167
- expect(r.errors.some(e => e.code === 'BP-007' && /name/.test(e.message))).toBe(true);
168
- });
169
- it('BP-007: rejects aspect entry with empty stages array', () => {
170
- const r = validateProcessBlueprint({
171
- ...VALID_BLUEPRINT,
172
- process_blueprint: {
173
- ...VALID_BLUEPRINT.process_blueprint,
174
- systems: [{ name: 'X', stages: [] }],
175
- },
176
- });
177
- expect(r.errors.some(e => e.code === 'BP-007' && /stages/.test(e.message))).toBe(true);
178
- });
179
- it('BP-008: rejects aspect entry referencing undeclared stage', () => {
180
- const r = validateProcessBlueprint({
181
- ...VALID_BLUEPRINT,
182
- process_blueprint: {
183
- ...VALID_BLUEPRINT.process_blueprint,
184
- systems: [{ name: 'X', stages: ['STAGE-1', 'STAGE-999'] }],
185
- },
186
- });
187
- expect(r.errors.some(e => e.code === 'BP-008')).toBe(true);
188
- });
189
- it('BP-009: rejects aspect entry id that does not match canonical grammar', () => {
190
- const r = validateProcessBlueprint({
191
- ...VALID_BLUEPRINT,
192
- process_blueprint: {
193
- ...VALID_BLUEPRINT.process_blueprint,
194
- equipment: [{ id: 'lowercase-1', name: 'X', stages: ['STAGE-1'] }],
195
- },
196
- });
197
- expect(r.errors.some(e => e.code === 'BP-009')).toBe(true);
198
- });
199
- it('BP-009: accepts an id for equipment as long as it matches general grammar', () => {
200
- const r = validateProcessBlueprint({
201
- ...VALID_BLUEPRINT,
202
- process_blueprint: {
203
- ...VALID_BLUEPRINT.process_blueprint,
204
- equipment: [{ id: 'EQUIPMENT-SCANNER-1', name: 'Barcode scanner', stages: ['STAGE-2'] }],
205
- },
206
- });
207
- expect(r.errors.some(e => e.code === 'BP-009')).toBe(false);
208
- expect(r.errors.some(e => e.code === 'BP-010')).toBe(false);
209
- });
210
- it('BP-010: rejects systems entry id without APPLICATION- prefix', () => {
211
- const r = validateProcessBlueprint({
212
- ...VALID_BLUEPRINT,
213
- process_blueprint: {
214
- ...VALID_BLUEPRINT.process_blueprint,
215
- systems: [{ id: 'SERVICE-OMS-1', name: 'OMS', stages: ['STAGE-1'] }],
216
- },
217
- });
218
- expect(r.errors.some(e => e.code === 'BP-010')).toBe(true);
219
- });
220
- it('BP-010: rejects actors entry id without ROLE- prefix', () => {
221
- const r = validateProcessBlueprint({
222
- ...VALID_BLUEPRINT,
223
- process_blueprint: {
224
- ...VALID_BLUEPRINT.process_blueprint,
225
- actors: [{ id: 'PERSON-1', name: 'X', stages: ['STAGE-1'] }],
226
- },
227
- });
228
- expect(r.errors.some(e => e.code === 'BP-010')).toBe(true);
229
- });
230
- it('BP-010: accepts free-form aspect entries without id', () => {
231
- const r = validateProcessBlueprint({
232
- ...VALID_BLUEPRINT,
233
- process_blueprint: {
234
- ...VALID_BLUEPRINT.process_blueprint,
235
- systems: [{ name: 'Legacy app', stages: ['STAGE-1'] }],
236
- },
237
- });
238
- expect(r.errors.some(e => e.code === 'BP-009')).toBe(false);
239
- expect(r.errors.some(e => e.code === 'BP-010')).toBe(false);
240
- });
241
- it('BP-011: warns when a stage has no aspect entries pointing at it', () => {
242
- const r = validateProcessBlueprint({
243
- ...VALID_BLUEPRINT,
244
- process_blueprint: {
245
- ...VALID_BLUEPRINT.process_blueprint,
246
- stages: [
247
- { id: 'STAGE-1', name: 'A', goal: 'G', result: 'R' },
248
- { id: 'STAGE-99', name: 'Orphan', goal: 'G', result: 'R' },
249
- ],
250
- systems: [{ id: 'APPLICATION-OMS-1', name: 'OMS', stages: ['STAGE-1'] }],
251
- actors: undefined,
252
- equipment: undefined,
253
- information_entities: undefined,
254
- },
255
- });
256
- expect(r.warnings.some(w => w.code === 'BP-011' && /STAGE-99/.test(w.message))).toBe(true);
257
- expect(r.valid).toBe(true);
258
- });
259
- // BP-012 was removed from the spec on 2026-05-21 (methodology PR #15):
260
- // a single-stage aspect entry is normal, valid blueprint content and the
261
- // warning fired on the common case. Studio side dropped to match.
262
- it('happy path: surfaces no warnings on a well-formed multi-stage blueprint', () => {
263
- const r = validateProcessBlueprint(VALID_BLUEPRINT);
264
- expect(r.valid).toBe(true);
265
- expect(r.warnings).toHaveLength(0);
266
- });
267
- });
268
- describe('process-blueprint examples (regression)', () => {
269
- const files = fs.readdirSync(EXAMPLES_DIR).filter(f => f.endsWith('.yaml'));
270
- expect(files.length).toBeGreaterThan(0);
271
- for (const file of files) {
272
- it(`validates tests/fixtures/notation-corpus/process-blueprint/${file}`, () => {
273
- const text = fs.readFileSync(path.join(EXAMPLES_DIR, file), 'utf8');
274
- const parsed = yaml.load(text);
275
- const r = validateProcessBlueprint(parsed);
276
- expect(r.errors).toEqual([]);
277
- expect(r.valid).toBe(true);
278
- });
279
- }
280
- });
@@ -1 +0,0 @@
1
- export {};