@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,57 +0,0 @@
1
- // Conformance — single-law tree + single-product view on the acme_corp worked
2
- // examples (mirrored under tests/fixtures/notation-corpus/requirement, tests/fixtures/notation-corpus/assertion). Pins the
3
- // #84 Phase 3 acceptance.
4
-
5
- import { describe, it, expect } from 'vitest';
6
- import { readdirSync, readFileSync } from 'node:fs';
7
- import { fileURLToPath } from 'node:url';
8
- import path from 'node:path';
9
- import yaml from 'js-yaml';
10
- import { buildComplianceIndex } from '../reverse-index.js';
11
- import { buildLawTree, buildProductView } from '../views.js';
12
- import type { IndexAssertion, IndexRequirement } from '../types.js';
13
-
14
- const examples = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../../tests/fixtures/notation-corpus');
15
- function loadAll(dir: string): Record<string, unknown>[] {
16
- const full = path.join(examples, dir);
17
- return readdirSync(full).filter(f => f.endsWith('.yaml')).map(f => yaml.load(readFileSync(path.join(full, f), 'utf-8')) as Record<string, unknown>);
18
- }
19
-
20
- const requirements: IndexRequirement[] = loadAll('requirement').map(r => ({
21
- id: String(r.id), name: String(r.name),
22
- severity: r.severity as string | undefined,
23
- derived_from: Array.isArray(r.derived_from) ? (r.derived_from as string[]) : undefined,
24
- }));
25
- const assertions: IndexAssertion[] = loadAll('assertion').map(a => ({
26
- id: String(a.id), about: String(a.about), subject: String(a.subject),
27
- status: a.status as IndexAssertion['status'],
28
- evidenceCount: Array.isArray(a.evidence) ? a.evidence.length : 0,
29
- }));
30
- const index = buildComplianceIndex({ requirements, assertions });
31
-
32
- describe('single-law tree — LAW-PERSONAL-DATA-2017-1', () => {
33
- const tree = buildLawTree('LAW-PERSONAL-DATA-2017-1', index);
34
- it('derives the data-erasure requirement with its three assertions', () => {
35
- expect(tree.requirements.map(r => r.requirement.id)).toEqual(['REQUIREMENT-DATA-ERASURE-1']);
36
- const node = tree.requirements[0];
37
- expect(node.assertions.map(a => a.id)).toEqual([
38
- 'ASSERTION-CRM-DATA-ERASURE-1',
39
- 'ASSERTION-MOBILE-DATA-ERASURE-1',
40
- 'ASSERTION-ONBOARD-DATA-ERASURE-1',
41
- ]);
42
- expect(node.assertions.map(a => a.status).sort()).toEqual(['compliant', 'partial', 'under_review']);
43
- });
44
- it('the internal-only audit-log requirement is not under any law', () => {
45
- expect(index.requirementsByLaw.has('LAW-PERSONAL-DATA-2017-1')).toBe(true);
46
- expect(tree.requirements.some(r => r.requirement.id === 'REQUIREMENT-AUDIT-LOG-RETENTION-1')).toBe(false);
47
- });
48
- });
49
-
50
- describe('single-product view — PRODUCT-MOBILE-1', () => {
51
- it('shows the data-erasure requirement as compliant', () => {
52
- const view = buildProductView('PRODUCT-MOBILE-1', index);
53
- expect(view.requirements.map(r => r.requirement.id)).toEqual(['REQUIREMENT-DATA-ERASURE-1']);
54
- expect(view.requirements[0].assertion.status).toBe('compliant');
55
- expect(view.requirements[0].requirement.name).toBe('Personal-data erasure on request within 30 days');
56
- });
57
- });
@@ -1,129 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { readdirSync, readFileSync } from 'node:fs';
3
- import { fileURLToPath } from 'node:url';
4
- import path from 'node:path';
5
- import yaml from 'js-yaml';
6
- import { buildComplianceIndex } from '../reverse-index.js';
7
- import { buildGapReport } from '../gap-report.js';
8
- import type { ComplianceIndexInput, IndexAssertion, IndexRequirement } from '../types.js';
9
-
10
- const input: ComplianceIndexInput = {
11
- requirements: [
12
- { id: 'REQUIREMENT-A-1', name: 'A', severity: 'high' }, // has assertions
13
- { id: 'REQUIREMENT-B-1', name: 'B', severity: 'low' }, // orphan
14
- { id: 'REQUIREMENT-C-1', name: 'C', severity: 'medium' }, // orphan
15
- { id: 'REQUIREMENT-D-1', name: 'D' }, // orphan, no severity
16
- ],
17
- assertions: [
18
- { id: 'ASSERTION-1', about: 'REQUIREMENT-A-1', subject: 'PRODUCT-1', status: 'compliant', evidenceCount: 0 }, // 007
19
- { id: 'ASSERTION-2', about: 'REQUIREMENT-A-1', subject: 'PRODUCT-2', status: 'under_review', evidenceCount: 0 }, // NOT 007
20
- { id: 'ASSERTION-3', about: 'REQUIREMENT-A-1', subject: 'PRODUCT-3', status: 'partial', evidenceCount: 2, next_review_at: '2025-01-01' }, // stale
21
- ],
22
- };
23
-
24
- describe('buildGapReport', () => {
25
- const index = buildComplianceIndex(input);
26
- const report = buildGapReport(index, { today: '2026-06-02' });
27
-
28
- it('lists requirements without assertions, severity-sorted (high→medium→low→none)', () => {
29
- expect(report.requirementsWithoutAssertions.map(r => r.id)).toEqual([
30
- 'REQUIREMENT-C-1', // medium
31
- 'REQUIREMENT-B-1', // low
32
- 'REQUIREMENT-D-1', // none
33
- ]);
34
- });
35
-
36
- it('flags only compliant/partial assertions with empty evidence (ASSERT-007)', () => {
37
- expect(report.assertionsWithoutEvidence.map(a => a.id)).toEqual(['ASSERTION-1']);
38
- // under_review with empty evidence is legitimate — not flagged.
39
- expect(report.assertionsWithoutEvidence.map(a => a.id)).not.toContain('ASSERTION-2');
40
- });
41
-
42
- it('flags assertions whose next_review_at is past today (ASSERT-008)', () => {
43
- expect(report.staleAssertions.map(a => a.id)).toEqual(['ASSERTION-3']);
44
- });
45
-
46
- it('produces no stale list when today is not supplied (clock-free)', () => {
47
- expect(buildGapReport(index, {}).staleAssertions).toEqual([]);
48
- });
49
- });
50
-
51
- // ── Conformance on the acme_corp worked examples ────────────────────────────
52
-
53
- const examples = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../../tests/fixtures/notation-corpus');
54
- function loadAll(dir: string): Record<string, unknown>[] {
55
- const full = path.join(examples, dir);
56
- return readdirSync(full).filter(f => f.endsWith('.yaml')).map(f => yaml.load(readFileSync(path.join(full, f), 'utf-8')) as Record<string, unknown>);
57
- }
58
-
59
- describe('gap report — acme_corp worked examples', () => {
60
- const requirements: IndexRequirement[] = loadAll('requirement').map(r => ({
61
- id: String(r.id), name: String(r.name), severity: r.severity as string | undefined,
62
- derived_from: Array.isArray(r.derived_from) ? (r.derived_from as string[]) : undefined,
63
- }));
64
- const assertions: IndexAssertion[] = loadAll('assertion').map(a => ({
65
- id: String(a.id), about: String(a.about), subject: String(a.subject),
66
- status: a.status as IndexAssertion['status'],
67
- next_review_at: a.next_review_at as string | undefined,
68
- evidenceCount: Array.isArray(a.evidence) ? a.evidence.length : 0,
69
- }));
70
- const report = buildGapReport(buildComplianceIndex({ requirements, assertions }), { today: '2026-06-02' });
71
-
72
- it('surfaces the internal audit-log requirement as an un-asserted gap', () => {
73
- expect(report.requirementsWithoutAssertions.map(r => r.id)).toEqual(['REQUIREMENT-AUDIT-LOG-RETENTION-1']);
74
- });
75
-
76
- it('does not flag the under_review empty-evidence assertion under ASSERT-007', () => {
77
- expect(report.assertionsWithoutEvidence).toEqual([]);
78
- });
79
-
80
- it('has no stale assertions (all acme reviews are in the future)', () => {
81
- expect(report.staleAssertions).toEqual([]);
82
- });
83
- });
84
-
85
- describe('CV-5 -- pastDeadlineRequirements', () => {
86
- it('lists requirements with past deadline and no compliant assertion', () => {
87
- const indexLocal = buildComplianceIndex({
88
- requirements: [
89
- { id: 'REQ-PD-1', name: 'Past deadline, no assertion', deadline: '2020-01-01' },
90
- { id: 'REQ-PD-2', name: 'Past deadline, non-compliant assertion', deadline: '2020-01-01' },
91
- { id: 'REQ-PD-3', name: 'Past deadline, compliant assertion', deadline: '2020-01-01' },
92
- { id: 'REQ-FU-1', name: 'Future deadline', deadline: '2099-01-01' },
93
- { id: 'REQ-ND-1', name: 'No deadline' },
94
- ],
95
- assertions: [
96
- { id: 'ASS-2', about: 'REQ-PD-2', subject: 'S', status: 'non_compliant' },
97
- { id: 'ASS-3', about: 'REQ-PD-3', subject: 'S', status: 'compliant' },
98
- ],
99
- });
100
- const r = buildGapReport(indexLocal, { today: '2026-06-09' });
101
- // REQ-PD-1 and REQ-PD-2 are past-deadline without full compliance
102
- expect(r.pastDeadlineRequirements.map(x => x.id)).toEqual(['REQ-PD-1', 'REQ-PD-2']);
103
- // REQ-PD-3 has a compliant assertion -> excluded
104
- expect(r.pastDeadlineRequirements.map(x => x.id)).not.toContain('REQ-PD-3');
105
- // Future or no deadline -> excluded
106
- expect(r.pastDeadlineRequirements.map(x => x.id)).not.toContain('REQ-FU-1');
107
- expect(r.pastDeadlineRequirements.map(x => x.id)).not.toContain('REQ-ND-1');
108
- });
109
-
110
- it('is empty when no today is supplied (clock-free)', () => {
111
- const idx2 = buildComplianceIndex({
112
- requirements: [{ id: 'REQ-PD-1', name: 'Past', deadline: '2020-01-01' }],
113
- assertions: [],
114
- });
115
- expect(buildGapReport(idx2, {}).pastDeadlineRequirements).toEqual([]);
116
- });
117
-
118
- it('sorts oldest deadline first', () => {
119
- const idx3 = buildComplianceIndex({
120
- requirements: [
121
- { id: 'REQ-A', name: 'A', deadline: '2022-06-01' },
122
- { id: 'REQ-B', name: 'B', deadline: '2019-01-01' },
123
- ],
124
- assertions: [],
125
- });
126
- const r3 = buildGapReport(idx3, { today: '2026-06-09' });
127
- expect(r3.pastDeadlineRequirements.map(x => x.id)).toEqual(['REQ-B', 'REQ-A']);
128
- });
129
- });
@@ -1,142 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { renderComplianceHtml } from '../html.js';
3
- import { emptyCanon, ingestComplianceDoc, type ComplianceCanon } from '../classify.js';
4
-
5
- function synthetic(): ComplianceCanon {
6
- const canon = emptyCanon();
7
- ingestComplianceDoc(canon, { notation: 'product', id: 'PRODUCT-M-1', name: 'Mobile App' });
8
- ingestComplianceDoc(canon, { notation: 'requirement', id: 'REQUIREMENT-ERASURE-1', name: 'Erasure', severity: 'high', derived_from: ['LAW-X-1'] });
9
- ingestComplianceDoc(canon, { notation: 'requirement', id: 'REQUIREMENT-LOG-1', name: 'Logs', severity: 'low' });
10
- ingestComplianceDoc(canon, {
11
- notation: 'assertion',
12
- id: 'ASSERTION-1',
13
- about: 'REQUIREMENT-ERASURE-1',
14
- subject: 'PRODUCT-M-1',
15
- status: 'compliant',
16
- evidence: [{ kind: 'note', text: 'x' }],
17
- next_review_at: '2026-09-01',
18
- });
19
- ingestComplianceDoc(canon, { id: 'LAW-X-1', name: 'Privacy Law', zone: 'codex', type: 'LAW' });
20
- return canon;
21
- }
22
-
23
- describe('renderComplianceHtml — document shell', () => {
24
- it('produces a complete HTML document with branded header and stamp', () => {
25
- const html = renderComplianceHtml(synthetic(), { mode: 'matrix' }, { today: '2026-06-03' });
26
- expect(html.startsWith('<!doctype html>')).toBe(true);
27
- expect(html).toContain('<title>Compliance Matrix</title>');
28
- expect(html).toContain('<div class="cmp-eyebrow">Transitrix · Compliance</div>');
29
- expect(html).toContain('<h1>Compliance Matrix</h1>');
30
- expect(html).toContain('Generated 2026-06-03');
31
- expect(html).toContain('@page');
32
- expect(html).toContain('size: A4 portrait');
33
- });
34
-
35
- it('escapes HTML in product and requirement names', () => {
36
- const canon = emptyCanon();
37
- ingestComplianceDoc(canon, { notation: 'product', id: 'PRODUCT-X-1', name: '<Mobile> & "Web"' });
38
- ingestComplianceDoc(canon, { notation: 'requirement', id: 'REQUIREMENT-X-1', name: 'A & B' });
39
- const html = renderComplianceHtml(canon, { mode: 'matrix' });
40
- expect(html).not.toMatch(/<Mobile>/);
41
- expect(html).toContain('&lt;Mobile&gt; &amp; &quot;Web&quot;');
42
- expect(html).toContain('A &amp; B');
43
- });
44
- });
45
-
46
- describe('renderComplianceHtml — matrix', () => {
47
- it('renders a table with status badges and gap cells', () => {
48
- const html = renderComplianceHtml(synthetic(), { mode: 'matrix' });
49
- expect(html).toContain('<table class="cmp-matrix">');
50
- expect(html).toContain('<th>Erasure</th>');
51
- expect(html).toContain('<th>Logs</th>');
52
- expect(html).toContain('<span class="cmp-badge cmp-compliant">Compliant</span>');
53
- expect(html).toMatch(/cmp-cell-gap/);
54
- expect(html).toContain('1 products × 2 requirements');
55
- });
56
-
57
- it('shows an empty-state message when nothing was scanned', () => {
58
- const html = renderComplianceHtml(emptyCanon(), { mode: 'matrix' });
59
- expect(html).toContain('No products or requirements found');
60
- });
61
- });
62
-
63
- describe('renderComplianceHtml — law', () => {
64
- it('renders the law name, requirement block, and assertion bullet with badge', () => {
65
- const html = renderComplianceHtml(synthetic(), { mode: 'law', id: 'LAW-X-1' });
66
- expect(html).toContain('<h1>Compliance — Privacy Law</h1>');
67
- expect(html).toContain('class="cmp-req-name">Erasure');
68
- expect(html).toContain('class="cmp-req-id">REQUIREMENT-ERASURE-1');
69
- expect(html).toContain('cmp-sev cmp-sev-high');
70
- expect(html).toContain('cmp-badge cmp-compliant');
71
- expect(html).toContain('review by 2026-09-01');
72
- });
73
-
74
- it('handles an unknown law id with an empty-state message', () => {
75
- const html = renderComplianceHtml(synthetic(), { mode: 'law', id: 'LAW-NONE' });
76
- expect(html).toContain('<h1>Compliance — LAW-NONE</h1>');
77
- expect(html).toContain('No requirements derive from');
78
- });
79
- });
80
-
81
- describe('renderComplianceHtml — product', () => {
82
- it('renders the product table of asserted requirements', () => {
83
- const html = renderComplianceHtml(synthetic(), { mode: 'product', id: 'PRODUCT-M-1' });
84
- expect(html).toContain('<h1>Compliance — Mobile App</h1>');
85
- expect(html).toContain('<th>Requirement</th>');
86
- expect(html).toContain('<th>Status</th>');
87
- expect(html).toContain('cmp-badge cmp-compliant');
88
- expect(html).toContain('2026-09-01');
89
- });
90
- });
91
-
92
- describe('renderComplianceHtml — gap', () => {
93
- it('lists the un-asserted requirement and shows ✓ none for clean sections', () => {
94
- const html = renderComplianceHtml(synthetic(), { mode: 'gap' }, { today: '2026-06-02' });
95
- expect(html).toContain('Requirements without assertions');
96
- expect(html).toContain('REQUIREMENT-LOG-1');
97
- expect(html).toContain('severity low');
98
- expect(html).toContain('Assertions without evidence — ASSERT-007');
99
- expect(html).toContain('Stale assertions — ASSERT-008');
100
- expect(html).toContain('class="cmp-ok">✓ none');
101
- });
102
-
103
- it('counts gaps in the summary line', () => {
104
- const html = renderComplianceHtml(synthetic(), { mode: 'gap' });
105
- expect(html).toMatch(/1 gap\(s\)/);
106
- });
107
- });
108
-
109
- // ── CV-6: renderImpactMatrixHtml ─────────────────────────────────────────────
110
-
111
- import { renderImpactMatrixHtml } from '../html.js';
112
- import { buildImpactMatrix } from '../impact.js';
113
-
114
- describe('renderImpactMatrixHtml (CV-6)', () => {
115
- it('returns a complete HTML document with matrix title and table', () => {
116
- const canon = emptyCanon();
117
- ingestComplianceDoc(canon, { notation: 'product', id: 'PROD-1', name: 'Product One' });
118
- ingestComplianceDoc(canon, { notation: 'requirement', id: 'REQ-1', name: 'Req One', severity: 'high' });
119
- ingestComplianceDoc(canon, { notation: 'assertion', id: 'ASS-1', about: 'REQ-1', subject: 'PROD-1', status: 'compliant' });
120
- const matrix = buildImpactMatrix(
121
- { products: canon.products, requirements: canon.requirements, assertions: canon.assertions, codex: canon.codex, subjects: canon.subjects },
122
- { id: 'VIEW-1', name: 'My View', subjects: { products: ['PROD-1'] }, obligations: {} },
123
- );
124
- const html = renderImpactMatrixHtml(matrix, { today: '2026-06-09' });
125
- expect(html).toContain('<table>');
126
- expect(html).toContain('My View');
127
- expect(html).toContain('VIEW-1');
128
- expect(html).toContain('OK');
129
- });
130
-
131
- it('renders gap cells with no_obligation_label text', () => {
132
- const canon = emptyCanon();
133
- ingestComplianceDoc(canon, { notation: 'product', id: 'PROD-1', name: 'P1' });
134
- ingestComplianceDoc(canon, { notation: 'requirement', id: 'REQ-1', name: 'R1' });
135
- const matrix = buildImpactMatrix(
136
- { products: canon.products, requirements: canon.requirements, assertions: canon.assertions, codex: canon.codex, subjects: canon.subjects },
137
- { id: 'V2', name: 'V2', subjects: { products: ['PROD-1'] }, obligations: {} },
138
- );
139
- const html = renderImpactMatrixHtml(matrix);
140
- expect(html).toContain('No mapped obligation');
141
- });
142
- });