@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.
- package/package.json +7 -2
- package/dist/__tests__/edge-path.test.d.ts +0 -1
- package/dist/__tests__/edge-path.test.js +0 -55
- package/dist/__tests__/node-size-presets.test.d.ts +0 -1
- package/dist/__tests__/node-size-presets.test.js +0 -30
- package/dist/__tests__/scope.test.d.ts +0 -1
- package/dist/__tests__/scope.test.js +0 -23
- package/dist/__tests__/yaml-normalize.test.d.ts +0 -1
- package/dist/__tests__/yaml-normalize.test.js +0 -148
- package/dist/activities/__tests__/cpm.test.d.ts +0 -1
- package/dist/activities/__tests__/cpm.test.js +0 -146
- package/dist/activities/__tests__/gantt.test.d.ts +0 -1
- package/dist/activities/__tests__/gantt.test.js +0 -263
- package/dist/activities/__tests__/layout.test.d.ts +0 -1
- package/dist/activities/__tests__/layout.test.js +0 -98
- package/dist/activities/__tests__/validate.test.d.ts +0 -1
- package/dist/activities/__tests__/validate.test.js +0 -397
- package/dist/activity-card/__tests__/example.test.d.ts +0 -1
- package/dist/activity-card/__tests__/example.test.js +0 -73
- package/dist/activity-card/__tests__/layout.test.d.ts +0 -1
- package/dist/activity-card/__tests__/layout.test.js +0 -141
- package/dist/activity-card/__tests__/resolver.test.d.ts +0 -1
- package/dist/activity-card/__tests__/resolver.test.js +0 -325
- package/dist/activity-card/__tests__/validate.test.d.ts +0 -1
- package/dist/activity-card/__tests__/validate.test.js +0 -149
- package/dist/actor/__tests__/validate.test.d.ts +0 -1
- package/dist/actor/__tests__/validate.test.js +0 -95
- package/dist/applications/__tests__/validate.test.d.ts +0 -1
- package/dist/applications/__tests__/validate.test.js +0 -223
- package/dist/assertion/__tests__/example.test.d.ts +0 -1
- package/dist/assertion/__tests__/example.test.js +0 -32
- package/dist/assertion/__tests__/validate.test.d.ts +0 -1
- package/dist/assertion/__tests__/validate.test.js +0 -130
- package/dist/blocks/__tests__/layout.test.d.ts +0 -1
- package/dist/blocks/__tests__/layout.test.js +0 -153
- package/dist/blocks/__tests__/validate.test.d.ts +0 -1
- package/dist/blocks/__tests__/validate.test.js +0 -235
- package/dist/business-service/__tests__/validate.test.d.ts +0 -1
- package/dist/business-service/__tests__/validate.test.js +0 -135
- package/dist/capability-map/__tests__/CapabilityMapView.test.d.ts +0 -1
- package/dist/capability-map/__tests__/CapabilityMapView.test.js +0 -217
- package/dist/capability-map/__tests__/address.test.d.ts +0 -1
- package/dist/capability-map/__tests__/address.test.js +0 -49
- package/dist/capability-map/__tests__/dsm-layout.test.d.ts +0 -1
- package/dist/capability-map/__tests__/dsm-layout.test.js +0 -46
- package/dist/capability-map/__tests__/dsm-mutations.test.d.ts +0 -1
- package/dist/capability-map/__tests__/dsm-mutations.test.js +0 -125
- package/dist/capability-map/__tests__/dsm-validate.test.d.ts +0 -1
- package/dist/capability-map/__tests__/dsm-validate.test.js +0 -56
- package/dist/capability-map/__tests__/validate.test.d.ts +0 -1
- package/dist/capability-map/__tests__/validate.test.js +0 -212
- package/dist/change/__tests__/validate.test.d.ts +0 -1
- package/dist/change/__tests__/validate.test.js +0 -79
- package/dist/codex/__tests__/example.test.d.ts +0 -1
- package/dist/codex/__tests__/example.test.js +0 -33
- package/dist/codex/__tests__/validate.test.d.ts +0 -1
- package/dist/codex/__tests__/validate.test.js +0 -68
- package/dist/compliance/__tests__/canon-catalog.test.d.ts +0 -1
- package/dist/compliance/__tests__/canon-catalog.test.js +0 -60
- package/dist/compliance/__tests__/classify.test.d.ts +0 -1
- package/dist/compliance/__tests__/classify.test.js +0 -58
- package/dist/compliance/__tests__/confidence.test.d.ts +0 -1
- package/dist/compliance/__tests__/confidence.test.js +0 -78
- package/dist/compliance/__tests__/coverage-metric.test.d.ts +0 -1
- package/dist/compliance/__tests__/coverage-metric.test.js +0 -264
- package/dist/compliance/__tests__/demo-scenario.test.d.ts +0 -1
- package/dist/compliance/__tests__/demo-scenario.test.js +0 -226
- package/dist/compliance/__tests__/example.test.d.ts +0 -1
- package/dist/compliance/__tests__/example.test.js +0 -51
- package/dist/compliance/__tests__/gap-report.test.d.ts +0 -1
- package/dist/compliance/__tests__/gap-report.test.js +0 -113
- package/dist/compliance/__tests__/html.test.d.ts +0 -1
- package/dist/compliance/__tests__/html.test.js +0 -122
- package/dist/compliance/__tests__/impact.test.d.ts +0 -1
- package/dist/compliance/__tests__/impact.test.js +0 -913
- package/dist/compliance/__tests__/markdown.test.d.ts +0 -1
- package/dist/compliance/__tests__/markdown.test.js +0 -85
- package/dist/compliance/__tests__/trace.test.d.ts +0 -1
- package/dist/compliance/__tests__/trace.test.js +0 -144
- package/dist/compliance/__tests__/view-resolution.test.d.ts +0 -1
- package/dist/compliance/__tests__/view-resolution.test.js +0 -59
- package/dist/compliance/__tests__/views.test.d.ts +0 -1
- package/dist/compliance/__tests__/views.test.js +0 -59
- package/dist/compliance-matrix/__tests__/build.test.d.ts +0 -1
- package/dist/compliance-matrix/__tests__/build.test.js +0 -183
- package/dist/compliance-matrix/__tests__/example.test.d.ts +0 -1
- package/dist/compliance-matrix/__tests__/example.test.js +0 -49
- package/dist/confidence/__tests__/score.test.d.ts +0 -1
- package/dist/confidence/__tests__/score.test.js +0 -188
- package/dist/constraint/__tests__/example.test.d.ts +0 -1
- package/dist/constraint/__tests__/example.test.js +0 -14
- package/dist/constraint/__tests__/validate.test.d.ts +0 -1
- package/dist/constraint/__tests__/validate.test.js +0 -58
- package/dist/factor/__tests__/validate.test.d.ts +0 -1
- package/dist/factor/__tests__/validate.test.js +0 -112
- package/dist/fgca/__tests__/chain-table.test.d.ts +0 -1
- package/dist/fgca/__tests__/chain-table.test.js +0 -158
- package/dist/fgca/__tests__/layout.test.d.ts +0 -1
- package/dist/fgca/__tests__/layout.test.js +0 -140
- package/dist/fgca/__tests__/parse-canonical.test.d.ts +0 -1
- package/dist/fgca/__tests__/parse-canonical.test.js +0 -268
- package/dist/fgca/__tests__/preview-layout.test.d.ts +0 -1
- package/dist/fgca/__tests__/preview-layout.test.js +0 -106
- package/dist/fgca/__tests__/resolver.test.d.ts +0 -1
- package/dist/fgca/__tests__/resolver.test.js +0 -185
- package/dist/fgca/__tests__/validate.test.d.ts +0 -1
- package/dist/fgca/__tests__/validate.test.js +0 -125
- package/dist/goals/__tests__/GoalTreeView.test.d.ts +0 -1
- package/dist/goals/__tests__/GoalTreeView.test.js +0 -337
- package/dist/goals/__tests__/layout.test.d.ts +0 -1
- package/dist/goals/__tests__/layout.test.js +0 -153
- package/dist/goals/__tests__/mutations.test.d.ts +0 -1
- package/dist/goals/__tests__/mutations.test.js +0 -134
- package/dist/goals/__tests__/parse-canonical.test.d.ts +0 -1
- package/dist/goals/__tests__/parse-canonical.test.js +0 -131
- package/dist/goals/__tests__/validate.test.d.ts +0 -1
- package/dist/goals/__tests__/validate.test.js +0 -183
- package/dist/integration/__tests__/validate.test.d.ts +0 -1
- package/dist/integration/__tests__/validate.test.js +0 -169
- package/dist/location/__tests__/validate.test.d.ts +0 -1
- package/dist/location/__tests__/validate.test.js +0 -107
- package/dist/node/__tests__/validate.test.d.ts +0 -1
- package/dist/node/__tests__/validate.test.js +0 -100
- package/dist/process-blueprint/__tests__/compliance-lane.test.d.ts +0 -1
- package/dist/process-blueprint/__tests__/compliance-lane.test.js +0 -272
- package/dist/process-blueprint/__tests__/layout.test.d.ts +0 -1
- package/dist/process-blueprint/__tests__/layout.test.js +0 -196
- package/dist/process-blueprint/__tests__/validate.test.d.ts +0 -1
- package/dist/process-blueprint/__tests__/validate.test.js +0 -280
- package/dist/process-map/__tests__/validate.test.d.ts +0 -1
- package/dist/process-map/__tests__/validate.test.js +0 -199
- package/dist/products/__tests__/validate.test.d.ts +0 -1
- package/dist/products/__tests__/validate.test.js +0 -210
- package/dist/repo-validate/__tests__/validate-repo.test.d.ts +0 -1
- package/dist/repo-validate/__tests__/validate-repo.test.js +0 -576
- package/dist/requirement/__tests__/example.test.d.ts +0 -1
- package/dist/requirement/__tests__/example.test.js +0 -21
- package/dist/requirement/__tests__/validate.test.d.ts +0 -1
- package/dist/requirement/__tests__/validate.test.js +0 -80
- package/dist/scenarios/__tests__/validate.test.d.ts +0 -1
- package/dist/scenarios/__tests__/validate.test.js +0 -183
- package/dist/stakeholder/__tests__/validate.test.d.ts +0 -1
- package/dist/stakeholder/__tests__/validate.test.js +0 -88
- package/dist/target-state/__tests__/validate.test.d.ts +0 -1
- package/dist/target-state/__tests__/validate.test.js +0 -78
- package/dist/technology-service/__tests__/validate.test.d.ts +0 -1
- package/dist/technology-service/__tests__/validate.test.js +0 -121
- package/dist/theme/__tests__/tokens.test.d.ts +0 -1
- package/dist/theme/__tests__/tokens.test.js +0 -159
- package/dist/webview/__tests__/entity-text-layout.test.d.ts +0 -1
- package/dist/webview/__tests__/entity-text-layout.test.js +0 -155
- package/dist/webview/__tests__/entry-notations.test.d.ts +0 -1
- package/dist/webview/__tests__/entry-notations.test.js +0 -62
- package/dist/webview/__tests__/entry.test.d.ts +0 -1
- package/dist/webview/__tests__/entry.test.js +0 -56
- package/dist/webview/__tests__/render-activities.test.d.ts +0 -1
- package/dist/webview/__tests__/render-activities.test.js +0 -91
- package/dist/webview/__tests__/render-blocks.test.d.ts +0 -1
- package/dist/webview/__tests__/render-blocks.test.js +0 -175
- package/dist/webview/__tests__/render-goals.test.d.ts +0 -1
- package/dist/webview/__tests__/render-goals.test.js +0 -120
- package/dist/webview/__tests__/render-process.test.d.ts +0 -1
- package/dist/webview/__tests__/render-process.test.js +0 -463
- package/dist/webview/__tests__/render-util.test.d.ts +0 -1
- package/dist/webview/__tests__/render-util.test.js +0 -54
- package/src/__tests__/edge-path.test.ts +0 -67
- package/src/__tests__/node-size-presets.test.ts +0 -50
- package/src/__tests__/scope.test.ts +0 -27
- package/src/__tests__/yaml-normalize.test.ts +0 -158
- package/src/activities/__tests__/cpm.test.ts +0 -164
- package/src/activities/__tests__/gantt.test.ts +0 -290
- package/src/activities/__tests__/layout.test.ts +0 -112
- package/src/activities/__tests__/validate.test.ts +0 -446
- package/src/activity-card/__tests__/example.test.ts +0 -83
- package/src/activity-card/__tests__/layout.test.ts +0 -162
- package/src/activity-card/__tests__/resolver.test.ts +0 -357
- package/src/activity-card/__tests__/validate.test.ts +0 -167
- package/src/actor/__tests__/validate.test.ts +0 -114
- package/src/applications/__tests__/validate.test.ts +0 -256
- package/src/assertion/__tests__/example.test.ts +0 -37
- package/src/assertion/__tests__/validate.test.ts +0 -142
- package/src/blocks/__tests__/layout.test.ts +0 -169
- package/src/blocks/__tests__/validate.test.ts +0 -260
- package/src/business-service/__tests__/validate.test.ts +0 -160
- package/src/capability-map/__tests__/CapabilityMapView.test.tsx +0 -232
- package/src/capability-map/__tests__/address.test.ts +0 -59
- package/src/capability-map/__tests__/dsm-layout.test.ts +0 -52
- package/src/capability-map/__tests__/dsm-mutations.test.ts +0 -141
- package/src/capability-map/__tests__/dsm-validate.test.ts +0 -65
- package/src/capability-map/__tests__/validate.test.ts +0 -238
- package/src/change/__tests__/validate.test.ts +0 -97
- package/src/codex/__tests__/example.test.ts +0 -40
- package/src/codex/__tests__/validate.test.ts +0 -84
- package/src/compliance/__tests__/canon-catalog.test.ts +0 -68
- package/src/compliance/__tests__/classify.test.ts +0 -64
- package/src/compliance/__tests__/confidence.test.ts +0 -98
- package/src/compliance/__tests__/coverage-metric.test.ts +0 -300
- package/src/compliance/__tests__/demo-scenario.test.ts +0 -273
- package/src/compliance/__tests__/example.test.ts +0 -57
- package/src/compliance/__tests__/gap-report.test.ts +0 -129
- package/src/compliance/__tests__/html.test.ts +0 -142
- package/src/compliance/__tests__/impact.test.ts +0 -1060
- package/src/compliance/__tests__/markdown.test.ts +0 -95
- package/src/compliance/__tests__/trace.test.ts +0 -157
- package/src/compliance/__tests__/view-resolution.test.ts +0 -80
- package/src/compliance/__tests__/views.test.ts +0 -64
- package/src/compliance-matrix/__tests__/build.test.ts +0 -200
- package/src/compliance-matrix/__tests__/example.test.ts +0 -57
- package/src/confidence/__tests__/score.test.ts +0 -254
- package/src/constraint/__tests__/example.test.ts +0 -19
- package/src/constraint/__tests__/validate.test.ts +0 -68
- package/src/factor/__tests__/validate.test.ts +0 -133
- package/src/fgca/__tests__/chain-table.test.ts +0 -172
- package/src/fgca/__tests__/layout.test.ts +0 -179
- package/src/fgca/__tests__/parse-canonical.test.ts +0 -296
- package/src/fgca/__tests__/preview-layout.test.ts +0 -124
- package/src/fgca/__tests__/resolver.test.ts +0 -209
- package/src/fgca/__tests__/validate.test.ts +0 -142
- package/src/goals/__tests__/GoalTreeView.test.tsx +0 -361
- package/src/goals/__tests__/layout.test.ts +0 -175
- package/src/goals/__tests__/mutations.test.ts +0 -153
- package/src/goals/__tests__/parse-canonical.test.ts +0 -147
- package/src/goals/__tests__/validate.test.ts +0 -202
- package/src/integration/__tests__/validate.test.ts +0 -203
- package/src/location/__tests__/validate.test.ts +0 -127
- package/src/node/__tests__/validate.test.ts +0 -118
- package/src/process-blueprint/__tests__/compliance-lane.test.ts +0 -320
- package/src/process-blueprint/__tests__/layout.test.ts +0 -240
- package/src/process-blueprint/__tests__/validate.test.ts +0 -310
- package/src/process-map/__tests__/validate.test.ts +0 -223
- package/src/products/__tests__/validate.test.ts +0 -239
- package/src/repo-validate/__tests__/validate-repo.test.ts +0 -699
- package/src/requirement/__tests__/example.test.ts +0 -24
- package/src/requirement/__tests__/validate.test.ts +0 -96
- package/src/scenarios/__tests__/validate.test.ts +0 -209
- package/src/stakeholder/__tests__/validate.test.ts +0 -105
- package/src/target-state/__tests__/validate.test.ts +0 -95
- package/src/technology-service/__tests__/validate.test.ts +0 -143
- package/src/theme/__tests__/tokens.test.ts +0 -185
- package/src/webview/__tests__/entity-text-layout.test.ts +0 -182
- package/src/webview/__tests__/entry-notations.test.ts +0 -77
- package/src/webview/__tests__/entry.test.ts +0 -64
- package/src/webview/__tests__/render-activities.test.ts +0 -100
- package/src/webview/__tests__/render-blocks.test.ts +0 -206
- package/src/webview/__tests__/render-goals.test.ts +0 -128
- package/src/webview/__tests__/render-process.test.ts +0 -538
- package/src/webview/__tests__/render-util.test.ts +0 -66
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { admitDocumentToCatalog, buildComplianceScan, catalogFromMap, } from '../canon-catalog.js';
|
|
3
|
-
describe('buildComplianceScan', () => {
|
|
4
|
-
it('admits codex, requirement, and assertion ids into the catalogue', () => {
|
|
5
|
-
const docs = [
|
|
6
|
-
{
|
|
7
|
-
path: 'codex/external/ge/LAW-PERSONAL-DATA-2017-1.yaml',
|
|
8
|
-
data: {
|
|
9
|
-
zone: 'codex',
|
|
10
|
-
id: 'LAW-PERSONAL-DATA-2017-1',
|
|
11
|
-
name: 'Law',
|
|
12
|
-
type: 'LAW',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
path: 'canon/elements/01_motivation/requirements/REQUIREMENT-DATA-ERASURE-1.yaml',
|
|
17
|
-
data: {
|
|
18
|
-
notation: 'requirement',
|
|
19
|
-
id: 'REQUIREMENT-DATA-ERASURE-1',
|
|
20
|
-
name: 'Erasure',
|
|
21
|
-
derived_from: ['LAW-PERSONAL-DATA-2017-1'],
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
path: 'canon/elements/02_business/products/PRODUCT-MOBILE-1.yaml',
|
|
26
|
-
data: { notation: 'product', id: 'PRODUCT-MOBILE-1', name: 'Mobile' },
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
path: 'canon/assertions/ASSERTION-MOBILE-DATA-ERASURE-1.yaml',
|
|
30
|
-
data: {
|
|
31
|
-
notation: 'assertion',
|
|
32
|
-
id: 'ASSERTION-MOBILE-DATA-ERASURE-1',
|
|
33
|
-
about: 'REQUIREMENT-DATA-ERASURE-1',
|
|
34
|
-
subject: 'PRODUCT-MOBILE-1',
|
|
35
|
-
status: 'compliant',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
];
|
|
39
|
-
const { catalog, complianceCanon, pathById } = buildComplianceScan(docs);
|
|
40
|
-
expect(catalog.typeOf('LAW-PERSONAL-DATA-2017-1')).toBe('LAW');
|
|
41
|
-
expect(catalog.typeOf('REQUIREMENT-DATA-ERASURE-1')).toBe('REQUIREMENT');
|
|
42
|
-
expect(catalog.typeOf('PRODUCT-MOBILE-1')).toBe('PRODUCT');
|
|
43
|
-
expect(complianceCanon.requirements).toHaveLength(1);
|
|
44
|
-
expect(complianceCanon.assertions).toHaveLength(1);
|
|
45
|
-
expect(complianceCanon.codex).toHaveLength(1);
|
|
46
|
-
expect(pathById.get('REQUIREMENT-DATA-ERASURE-1')).toContain('requirements/');
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
describe('admitDocumentToCatalog', () => {
|
|
50
|
-
it('uses explicit codex type when the id prefix is ambiguous', () => {
|
|
51
|
-
const map = new Map();
|
|
52
|
-
admitDocumentToCatalog(map, {
|
|
53
|
-
zone: 'codex',
|
|
54
|
-
id: 'INTERNAL_STANDARD-coding-conventions-1',
|
|
55
|
-
type: 'INTERNAL_STANDARD',
|
|
56
|
-
});
|
|
57
|
-
const catalog = catalogFromMap(map);
|
|
58
|
-
expect(catalog.typeOf('INTERNAL_STANDARD-coding-conventions-1')).toBe('INTERNAL_STANDARD');
|
|
59
|
-
});
|
|
60
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { emptyCanon, ingestComplianceDoc } from '../classify.js';
|
|
3
|
-
describe('ingestComplianceDoc', () => {
|
|
4
|
-
it('buckets each artefact kind by notation / zone', () => {
|
|
5
|
-
const canon = emptyCanon();
|
|
6
|
-
expect(ingestComplianceDoc(canon, { notation: 'product', id: 'PRODUCT-1', name: 'P' })).toBe('PRODUCT-1');
|
|
7
|
-
expect(ingestComplianceDoc(canon, { notation: 'requirement', id: 'REQUIREMENT-1', name: 'R', severity: 'high', derived_from: ['LAW-1'], admitted_at: '2026-05-28' })).toBe('REQUIREMENT-1');
|
|
8
|
-
expect(ingestComplianceDoc(canon, { notation: 'assertion', id: 'ASSERTION-1', about: 'REQUIREMENT-1', subject: 'PRODUCT-1', status: 'compliant', evidence: [{ kind: 'note', text: 'x' }], admitted_at: '2026-05-28' })).toBe('ASSERTION-1');
|
|
9
|
-
expect(ingestComplianceDoc(canon, { id: 'LAW-1', name: 'Law', type: 'LAW', zone: 'codex', jurisdiction: 'ge' })).toBe('LAW-1');
|
|
10
|
-
expect(canon.products).toEqual([{ id: 'PRODUCT-1', name: 'P' }]);
|
|
11
|
-
expect(canon.requirements[0]).toMatchObject({ id: 'REQUIREMENT-1', severity: 'high', derived_from: ['LAW-1'] });
|
|
12
|
-
expect(canon.assertions[0]).toMatchObject({ id: 'ASSERTION-1', status: 'compliant', evidenceCount: 1 });
|
|
13
|
-
expect(canon.codex[0]).toMatchObject({ id: 'LAW-1', type: 'LAW', jurisdiction: 'ge' });
|
|
14
|
-
expect(canon.subjects).toEqual([]);
|
|
15
|
-
});
|
|
16
|
-
it('ingests capability, process, application, system into canon.subjects', () => {
|
|
17
|
-
const canon = emptyCanon();
|
|
18
|
-
expect(ingestComplianceDoc(canon, { notation: 'capability', id: 'CAPABILITY-V2', name: 'CRM' })).toBe('CAPABILITY-V2');
|
|
19
|
-
expect(ingestComplianceDoc(canon, { notation: 'process', id: 'PROCESS-CS-1', name: 'Support' })).toBe('PROCESS-CS-1');
|
|
20
|
-
expect(ingestComplianceDoc(canon, { notation: 'application', id: 'APP-ERP-1', name: 'ERP System' })).toBe('APP-ERP-1');
|
|
21
|
-
expect(ingestComplianceDoc(canon, { notation: 'system', id: 'SYSTEM-IAM-1', name: 'IAM' })).toBe('SYSTEM-IAM-1');
|
|
22
|
-
expect(canon.subjects).toEqual([
|
|
23
|
-
{ id: 'CAPABILITY-V2', name: 'CRM' },
|
|
24
|
-
{ id: 'PROCESS-CS-1', name: 'Support' },
|
|
25
|
-
{ id: 'APP-ERP-1', name: 'ERP System' },
|
|
26
|
-
{ id: 'SYSTEM-IAM-1', name: 'IAM' },
|
|
27
|
-
]);
|
|
28
|
-
expect(canon.products).toEqual([]);
|
|
29
|
-
});
|
|
30
|
-
it('falls back to id when name is absent for subjects', () => {
|
|
31
|
-
const canon = emptyCanon();
|
|
32
|
-
ingestComplianceDoc(canon, { notation: 'capability', id: 'CAPABILITY-X-1' });
|
|
33
|
-
expect(canon.subjects[0]).toEqual({ id: 'CAPABILITY-X-1', name: 'CAPABILITY-X-1' });
|
|
34
|
-
});
|
|
35
|
-
it('captures owner_to_confirm on pending_owner assertions', () => {
|
|
36
|
-
const canon = emptyCanon();
|
|
37
|
-
ingestComplianceDoc(canon, {
|
|
38
|
-
notation: 'assertion', id: 'ASSERTION-PO-1',
|
|
39
|
-
about: 'REQUIREMENT-1', subject: 'PRODUCT-1',
|
|
40
|
-
status: 'pending_owner', owner_to_confirm: 'alice@example.com',
|
|
41
|
-
});
|
|
42
|
-
expect(canon.assertions[0]).toMatchObject({
|
|
43
|
-
id: 'ASSERTION-PO-1',
|
|
44
|
-
status: 'pending_owner',
|
|
45
|
-
owner_to_confirm: 'alice@example.com',
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
it('returns null for non-artefacts, missing id, and malformed assertions', () => {
|
|
49
|
-
const canon = emptyCanon();
|
|
50
|
-
expect(ingestComplianceDoc(canon, { notation: 'goals', id: 'X-1' })).toBeNull();
|
|
51
|
-
expect(ingestComplianceDoc(canon, { notation: 'product' })).toBeNull(); // no id
|
|
52
|
-
expect(ingestComplianceDoc(canon, { notation: 'assertion', id: 'ASSERTION-2', about: 'R' })).toBeNull(); // missing subject/status
|
|
53
|
-
expect(ingestComplianceDoc(canon, null)).toBeNull();
|
|
54
|
-
expect(ingestComplianceDoc(canon, 'str')).toBeNull();
|
|
55
|
-
expect(canon.products).toEqual([]);
|
|
56
|
-
expect(canon.subjects).toEqual([]);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// Bridge from the compliance index projections to the DQ-1 confidence module
|
|
2
|
-
// (vkgeorgia/strategy#162 — DQ-2). Pins that:
|
|
3
|
-
// • element TYPEs lift to REQUIREMENT / ASSERTION (decay lookup keys),
|
|
4
|
-
// • admitted_at flows through to the freshness curve,
|
|
5
|
-
// • the §11.6 header line matches the spec example shape,
|
|
6
|
-
// • an empty view suppresses the header (caller-controlled).
|
|
7
|
-
import { describe, it, expect } from 'vitest';
|
|
8
|
-
import { assertionToScoringElement, complianceConfidenceHeader, requirementToScoringElement, scoreComplianceView, } from '../confidence.js';
|
|
9
|
-
const req = (over = {}) => ({
|
|
10
|
-
id: 'REQUIREMENT-1', name: 'R', admitted_at: '2026-05-01', ...over,
|
|
11
|
-
});
|
|
12
|
-
const ass = (over = {}) => ({
|
|
13
|
-
id: 'ASSERTION-1', about: 'REQUIREMENT-1', subject: 'PRODUCT-1',
|
|
14
|
-
status: 'compliant', admitted_at: '2026-05-01', ...over,
|
|
15
|
-
});
|
|
16
|
-
describe('requirementToScoringElement / assertionToScoringElement', () => {
|
|
17
|
-
it('lifts the index projection to a ScoringElement', () => {
|
|
18
|
-
expect(requirementToScoringElement(req())).toEqual({
|
|
19
|
-
type: 'REQUIREMENT', admitted_at: '2026-05-01',
|
|
20
|
-
});
|
|
21
|
-
expect(assertionToScoringElement(ass())).toEqual({
|
|
22
|
-
type: 'ASSERTION', admitted_at: '2026-05-01',
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
it('leaves sources undefined — v1 has no field-zone provenance to resolve', () => {
|
|
26
|
-
// Documents the §11.5 behaviour: until DSM/Studio ingest field-zone
|
|
27
|
-
// source_quality, every element scores unsourced and is counted separately.
|
|
28
|
-
expect(requirementToScoringElement(req()).sources).toBeUndefined();
|
|
29
|
-
expect(assertionToScoringElement(ass()).sources).toBeUndefined();
|
|
30
|
-
});
|
|
31
|
-
it('preserves an absent admitted_at as undefined', () => {
|
|
32
|
-
expect(requirementToScoringElement(req({ admitted_at: undefined })).admitted_at).toBeUndefined();
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
describe('scoreComplianceView', () => {
|
|
36
|
-
it('scores the union of requirements + assertions and reports today', () => {
|
|
37
|
-
const v = scoreComplianceView([req()], [ass()], '2026-06-07');
|
|
38
|
-
expect(v.today).toBe('2026-06-07');
|
|
39
|
-
expect(v.elements).toHaveLength(2);
|
|
40
|
-
expect(v.composite.element_count).toBe(2);
|
|
41
|
-
// Two fresh elements (37 days old, ≤ implicit fresh_days=180) → freshness=1.0,
|
|
42
|
-
// but no sources → source_trust=0.25 floor → confidence=0.25, band D.
|
|
43
|
-
for (const e of v.elements) {
|
|
44
|
-
expect(e.freshness).toBe(1.0);
|
|
45
|
-
expect(e.source_trust).toBe(0.25);
|
|
46
|
-
expect(e.confidence).toBe(0.25);
|
|
47
|
-
expect(e.sourced).toBe(false);
|
|
48
|
-
}
|
|
49
|
-
expect(v.composite.band).toBe('D');
|
|
50
|
-
expect(v.composite.coverage).toBe(0);
|
|
51
|
-
expect(v.composite.unsourced_count).toBe(2);
|
|
52
|
-
});
|
|
53
|
-
it('returns the degenerate composite for an empty view', () => {
|
|
54
|
-
const v = scoreComplianceView([], [], '2026-06-07');
|
|
55
|
-
expect(v.composite.element_count).toBe(0);
|
|
56
|
-
expect(v.elements).toHaveLength(0);
|
|
57
|
-
});
|
|
58
|
-
it('honours per-TYPE decay overrides from the manifest config', () => {
|
|
59
|
-
// ASSERTION decays faster than REQUIREMENT — exercise the by_type lookup.
|
|
60
|
-
const v = scoreComplianceView([req({ admitted_at: '2025-01-01' })], [ass({ admitted_at: '2025-01-01' })], '2026-06-07', {
|
|
61
|
-
by_type: {
|
|
62
|
-
REQUIREMENT: { fresh_days: 1000, stale_days: 2000, floor: 0.5 },
|
|
63
|
-
ASSERTION: { fresh_days: 30, stale_days: 60, floor: 0.1 },
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
// Requirement is still well within fresh_days=1000 → freshness 1.0.
|
|
67
|
-
expect(v.elements[0].freshness).toBe(1.0);
|
|
68
|
-
// Assertion is well past stale_days=60 → freshness floors at 0.1.
|
|
69
|
-
expect(v.elements[1].freshness).toBeCloseTo(0.1, 10);
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
describe('complianceConfidenceHeader', () => {
|
|
73
|
-
it('formats the §11.6 example shape and returns empty for an empty view', () => {
|
|
74
|
-
expect(complianceConfidenceHeader([], [], '2026-06-07')).toBe('');
|
|
75
|
-
const line = complianceConfidenceHeader([req()], [ass()], '2026-06-07');
|
|
76
|
-
expect(line).toMatch(/^Data confidence \(as of 2026-06-07\): D \(weakest link\) · 0\.25 mean · 0% sourced$/);
|
|
77
|
-
});
|
|
78
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { parseCoverageMetricConfig, buildCoverageMatrix, } from '../coverage-metric.js';
|
|
3
|
-
import { emptyCanon, ingestComplianceDoc } from '../classify.js';
|
|
4
|
-
// ── parseCoverageMetricConfig ─────────────────────────────────────────────────
|
|
5
|
-
describe('parseCoverageMetricConfig', () => {
|
|
6
|
-
it('rejects null', () => {
|
|
7
|
-
const r = parseCoverageMetricConfig(null);
|
|
8
|
-
expect(r.ok).toBe(false);
|
|
9
|
-
});
|
|
10
|
-
it('rejects missing id', () => {
|
|
11
|
-
const r = parseCoverageMetricConfig({ view: { name: 'x' } });
|
|
12
|
-
expect(r.ok).toBe(false);
|
|
13
|
-
if (!r.ok)
|
|
14
|
-
expect(r.errors.some(e => e.includes('id'))).toBe(true);
|
|
15
|
-
});
|
|
16
|
-
it('parses minimal config via view: wrapper', () => {
|
|
17
|
-
const r = parseCoverageMetricConfig({
|
|
18
|
-
view: { id: 'CM-1', name: 'Test' },
|
|
19
|
-
});
|
|
20
|
-
expect(r.ok).toBe(true);
|
|
21
|
-
if (r.ok) {
|
|
22
|
-
expect(r.config.id).toBe('CM-1');
|
|
23
|
-
expect(r.config.name).toBe('Test');
|
|
24
|
-
expect(r.config.thresholds.green).toBe(0.8);
|
|
25
|
-
expect(r.config.thresholds.amber).toBe(0.5);
|
|
26
|
-
expect(r.config.regimes).toBeUndefined();
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
it('parses view: wrapper with regimes.include and subjects', () => {
|
|
30
|
-
const r = parseCoverageMetricConfig({
|
|
31
|
-
view: {
|
|
32
|
-
id: 'CM-2',
|
|
33
|
-
name: 'EU Coverage',
|
|
34
|
-
description: 'desc',
|
|
35
|
-
regimes: { include: ['LAW-GDPR-1'] },
|
|
36
|
-
subjects: { products: ['PRODUCT-1'] },
|
|
37
|
-
thresholds: { green: 0.9, amber: 0.6 },
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
expect(r.ok).toBe(true);
|
|
41
|
-
if (r.ok) {
|
|
42
|
-
expect(r.config.regimes?.include).toEqual(['LAW-GDPR-1']);
|
|
43
|
-
expect(r.config.subjects?.products).toEqual(['PRODUCT-1']);
|
|
44
|
-
expect(r.config.thresholds.green).toBe(0.9);
|
|
45
|
-
expect(r.config.thresholds.amber).toBe(0.6);
|
|
46
|
-
expect(r.config.warnings).toBeUndefined();
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
it('parses view: wrapper with regimes.filter', () => {
|
|
50
|
-
const r = parseCoverageMetricConfig({
|
|
51
|
-
view: {
|
|
52
|
-
id: 'CM-3',
|
|
53
|
-
name: 'EU Filter',
|
|
54
|
-
regimes: { filter: { jurisdiction: ['EU'], codex_type: ['regulation'] } },
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
expect(r.ok).toBe(true);
|
|
58
|
-
if (r.ok) {
|
|
59
|
-
expect(r.config.regimes?.filter?.jurisdiction).toEqual(['EU']);
|
|
60
|
-
expect(r.config.regimes?.filter?.codex_type).toEqual(['regulation']);
|
|
61
|
-
expect(r.config.regimes?.include).toBeUndefined();
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
it('warns COVMET-007 when both regimes.include and regimes.filter are set', () => {
|
|
65
|
-
const r = parseCoverageMetricConfig({
|
|
66
|
-
view: {
|
|
67
|
-
id: 'CM-4',
|
|
68
|
-
name: 'Both',
|
|
69
|
-
regimes: {
|
|
70
|
-
include: ['LAW-GDPR-1'],
|
|
71
|
-
filter: { jurisdiction: ['EU'] },
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
expect(r.ok).toBe(true);
|
|
76
|
-
if (r.ok) {
|
|
77
|
-
expect(r.config.warnings?.some(w => w.includes('COVMET-007'))).toBe(true);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
it('accepts bare (unwrapped) object without wrapper warning', () => {
|
|
81
|
-
const r = parseCoverageMetricConfig({ id: 'CM-5', name: 'Bare' });
|
|
82
|
-
expect(r.ok).toBe(true);
|
|
83
|
-
if (r.ok) {
|
|
84
|
-
expect(r.config.warnings?.some(w => w.includes('COVMET-DEPRECATED'))).toBeFalsy();
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
// ── Backward compatibility: deprecated coverage_metric: wrapper ──────────────
|
|
88
|
-
it('accepts deprecated coverage_metric: wrapper with COVMET-DEPRECATED warning', () => {
|
|
89
|
-
const r = parseCoverageMetricConfig({
|
|
90
|
-
coverage_metric: { id: 'CM-6', name: 'Legacy' },
|
|
91
|
-
});
|
|
92
|
-
expect(r.ok).toBe(true);
|
|
93
|
-
if (r.ok) {
|
|
94
|
-
expect(r.config.warnings?.some(w => w.includes('COVMET-DEPRECATED'))).toBe(true);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
it('maps deprecated scope.codex to regimes.include', () => {
|
|
98
|
-
const r = parseCoverageMetricConfig({
|
|
99
|
-
coverage_metric: {
|
|
100
|
-
id: 'CM-7',
|
|
101
|
-
name: 'Legacy Scope',
|
|
102
|
-
scope: {
|
|
103
|
-
codex: ['LAW-GDPR-1', 'LAW-NIS2-1'],
|
|
104
|
-
subjects: { products: ['PRODUCT-1'] },
|
|
105
|
-
},
|
|
106
|
-
thresholds: { green: 0.9, amber: 0.6 },
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
|
-
expect(r.ok).toBe(true);
|
|
110
|
-
if (r.ok) {
|
|
111
|
-
expect(r.config.regimes?.include).toEqual(['LAW-GDPR-1', 'LAW-NIS2-1']);
|
|
112
|
-
expect(r.config.subjects?.products).toEqual(['PRODUCT-1']);
|
|
113
|
-
expect(r.config.thresholds.green).toBe(0.9);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
// ── buildCoverageMatrix ───────────────────────────────────────────────────────
|
|
118
|
-
function makeCanon() {
|
|
119
|
-
const canon = emptyCanon();
|
|
120
|
-
ingestComplianceDoc(canon, { id: 'LAW-GDPR-1', name: 'GDPR', zone: 'codex', jurisdiction: 'EU' });
|
|
121
|
-
ingestComplianceDoc(canon, { notation: 'requirement', id: 'REQ-1', name: 'Lawful basis', derived_from: ['LAW-GDPR-1'] });
|
|
122
|
-
ingestComplianceDoc(canon, { notation: 'requirement', id: 'REQ-2', name: 'Data minimisation', derived_from: ['LAW-GDPR-1'] });
|
|
123
|
-
ingestComplianceDoc(canon, { notation: 'requirement', id: 'REQ-3', name: 'Breach notification', derived_from: ['LAW-GDPR-1'] });
|
|
124
|
-
ingestComplianceDoc(canon, { notation: 'product', id: 'PRODUCT-1', name: 'E-commerce' });
|
|
125
|
-
ingestComplianceDoc(canon, { notation: 'assertion', id: 'ASSERTION-1', about: 'REQ-1', subject: 'PRODUCT-1', status: 'compliant' });
|
|
126
|
-
ingestComplianceDoc(canon, { notation: 'assertion', id: 'ASSERTION-2', about: 'REQ-2', subject: 'PRODUCT-1', status: 'partial' });
|
|
127
|
-
// REQ-3 has no assertion → gap
|
|
128
|
-
return canon;
|
|
129
|
-
}
|
|
130
|
-
function makeConfig(overrides) {
|
|
131
|
-
return {
|
|
132
|
-
id: 'CM-TEST-1',
|
|
133
|
-
name: 'Test Coverage',
|
|
134
|
-
regimes: { include: ['LAW-GDPR-1'] },
|
|
135
|
-
subjects: { products: ['PRODUCT-1'] },
|
|
136
|
-
thresholds: { green: 0.8, amber: 0.5 },
|
|
137
|
-
...overrides,
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
describe('buildCoverageMatrix', () => {
|
|
141
|
-
it('returns correct row counts', () => {
|
|
142
|
-
const matrix = buildCoverageMatrix(makeCanon(), makeConfig());
|
|
143
|
-
expect(matrix.rows).toHaveLength(1);
|
|
144
|
-
const row = matrix.rows[0];
|
|
145
|
-
expect(row.codexId).toBe('LAW-GDPR-1');
|
|
146
|
-
expect(row.totalRequirements).toBe(3);
|
|
147
|
-
expect(row.compliant).toBe(1);
|
|
148
|
-
expect(row.partial).toBe(1);
|
|
149
|
-
expect(row.gap).toBe(1);
|
|
150
|
-
expect(row.coveredCount).toBe(2);
|
|
151
|
-
});
|
|
152
|
-
it('computes coverage percentage correctly', () => {
|
|
153
|
-
const row = buildCoverageMatrix(makeCanon(), makeConfig()).rows[0];
|
|
154
|
-
expect(row.coveragePct).toBeCloseTo(2 / 3, 5);
|
|
155
|
-
});
|
|
156
|
-
it('assigns amber RAG status for ~67% coverage with green=0.80, amber=0.50', () => {
|
|
157
|
-
expect(buildCoverageMatrix(makeCanon(), makeConfig()).rows[0].ragStatus).toBe('amber');
|
|
158
|
-
});
|
|
159
|
-
it('assigns green RAG when all requirements covered', () => {
|
|
160
|
-
const canon = makeCanon();
|
|
161
|
-
ingestComplianceDoc(canon, { notation: 'assertion', id: 'ASSERTION-3', about: 'REQ-3', subject: 'PRODUCT-1', status: 'compliant' });
|
|
162
|
-
const matrix = buildCoverageMatrix(canon, makeConfig());
|
|
163
|
-
expect(matrix.rows[0].ragStatus).toBe('green');
|
|
164
|
-
expect(matrix.rows[0].coveragePct).toBe(1);
|
|
165
|
-
});
|
|
166
|
-
it('assigns red RAG when coverage < amber threshold', () => {
|
|
167
|
-
const matrix = buildCoverageMatrix(makeCanon(), makeConfig({ thresholds: { green: 0.9, amber: 0.8 } }));
|
|
168
|
-
expect(matrix.rows[0].ragStatus).toBe('red');
|
|
169
|
-
});
|
|
170
|
-
it('returns no_data when codex has no requirements', () => {
|
|
171
|
-
const canon = emptyCanon();
|
|
172
|
-
ingestComplianceDoc(canon, { id: 'LAW-EMPTY-1', name: 'Empty Law', zone: 'codex', jurisdiction: 'XX' });
|
|
173
|
-
const matrix = buildCoverageMatrix(canon, makeConfig({ regimes: { include: ['LAW-EMPTY-1'] } }));
|
|
174
|
-
expect(matrix.rows[0].ragStatus).toBe('no_data');
|
|
175
|
-
expect(matrix.rows[0].totalRequirements).toBe(0);
|
|
176
|
-
});
|
|
177
|
-
it('includes jurisdiction from scanned canon', () => {
|
|
178
|
-
expect(buildCoverageMatrix(makeCanon(), makeConfig()).rows[0].jurisdiction).toBe('EU');
|
|
179
|
-
});
|
|
180
|
-
it('handles multiple codex entries via regimes.include', () => {
|
|
181
|
-
const canon = makeCanon();
|
|
182
|
-
ingestComplianceDoc(canon, { id: 'LAW-NIS2-1', name: 'NIS2', zone: 'codex', jurisdiction: 'EU' });
|
|
183
|
-
ingestComplianceDoc(canon, { notation: 'requirement', id: 'REQ-NIS-1', name: 'Incident reporting', derived_from: ['LAW-NIS2-1'] });
|
|
184
|
-
const matrix = buildCoverageMatrix(canon, makeConfig({ regimes: { include: ['LAW-GDPR-1', 'LAW-NIS2-1'] } }));
|
|
185
|
-
expect(matrix.rows).toHaveLength(2);
|
|
186
|
-
expect(matrix.rows[1].codexId).toBe('LAW-NIS2-1');
|
|
187
|
-
expect(matrix.rows[1].gap).toBe(1);
|
|
188
|
-
});
|
|
189
|
-
it('respects product scope — ignores assertions for other products', () => {
|
|
190
|
-
const canon = makeCanon();
|
|
191
|
-
ingestComplianceDoc(canon, { notation: 'product', id: 'PRODUCT-2', name: 'Support' });
|
|
192
|
-
ingestComplianceDoc(canon, { notation: 'assertion', id: 'ASSERTION-OUT', about: 'REQ-3', subject: 'PRODUCT-2', status: 'compliant' });
|
|
193
|
-
const matrix = buildCoverageMatrix(canon, makeConfig({
|
|
194
|
-
regimes: { include: ['LAW-GDPR-1'] },
|
|
195
|
-
subjects: { products: ['PRODUCT-1'] },
|
|
196
|
-
}));
|
|
197
|
-
expect(matrix.rows[0].gap).toBe(1);
|
|
198
|
-
});
|
|
199
|
-
it('counts non_compliant separately', () => {
|
|
200
|
-
const canon = makeCanon();
|
|
201
|
-
ingestComplianceDoc(canon, { notation: 'assertion', id: 'ASSERTION-FAIL', about: 'REQ-3', subject: 'PRODUCT-1', status: 'non_compliant' });
|
|
202
|
-
const matrix = buildCoverageMatrix(canon, makeConfig());
|
|
203
|
-
expect(matrix.rows[0].non_compliant).toBe(1);
|
|
204
|
-
expect(matrix.rows[0].gap).toBe(0);
|
|
205
|
-
expect(matrix.rows[0].coveredCount).toBe(2);
|
|
206
|
-
});
|
|
207
|
-
it('counts pending_owner separately and does not include it in coveredCount', () => {
|
|
208
|
-
const canon = makeCanon();
|
|
209
|
-
ingestComplianceDoc(canon, { notation: 'assertion', id: 'ASSERTION-PO', about: 'REQ-3', subject: 'PRODUCT-1', status: 'pending_owner', owner_to_confirm: 'alice' });
|
|
210
|
-
const matrix = buildCoverageMatrix(canon, makeConfig());
|
|
211
|
-
expect(matrix.rows[0].pending_owner).toBe(1);
|
|
212
|
-
expect(matrix.rows[0].gap).toBe(0);
|
|
213
|
-
expect(matrix.rows[0].coveredCount).toBe(2);
|
|
214
|
-
});
|
|
215
|
-
// ── regimes.filter ───────────────────────────────────────────────────────────
|
|
216
|
-
it('resolves codex via regimes.filter.jurisdiction', () => {
|
|
217
|
-
const canon = makeCanon();
|
|
218
|
-
ingestComplianceDoc(canon, { id: 'LAW-CCPA-1', name: 'CCPA', zone: 'codex', jurisdiction: 'US' });
|
|
219
|
-
// regimes.filter: only EU laws → should return LAW-GDPR-1 only
|
|
220
|
-
const matrix = buildCoverageMatrix(canon, makeConfig({
|
|
221
|
-
regimes: { filter: { jurisdiction: ['EU'] } },
|
|
222
|
-
}));
|
|
223
|
-
expect(matrix.rows.every(r => r.codexId !== 'LAW-CCPA-1')).toBe(true);
|
|
224
|
-
expect(matrix.rows.some(r => r.codexId === 'LAW-GDPR-1')).toBe(true);
|
|
225
|
-
});
|
|
226
|
-
it('resolves codex via regimes.filter.codex_type', () => {
|
|
227
|
-
const canon = emptyCanon();
|
|
228
|
-
ingestComplianceDoc(canon, { id: 'LAW-A', name: 'Regulation A', zone: 'codex', type: 'regulation' });
|
|
229
|
-
ingestComplianceDoc(canon, { id: 'LAW-B', name: 'Standard B', zone: 'codex', type: 'standard' });
|
|
230
|
-
const matrix = buildCoverageMatrix(canon, makeConfig({
|
|
231
|
-
regimes: { filter: { codex_type: ['regulation'] } },
|
|
232
|
-
}));
|
|
233
|
-
expect(matrix.rows.map(r => r.codexId)).toEqual(['LAW-A']);
|
|
234
|
-
});
|
|
235
|
-
// ── Zero-config: all canon codex entries ─────────────────────────────────────
|
|
236
|
-
it('zero-config (no regimes) enumerates all canon codex', () => {
|
|
237
|
-
const canon = makeCanon();
|
|
238
|
-
ingestComplianceDoc(canon, { id: 'LAW-NIS2-1', name: 'NIS2', zone: 'codex', jurisdiction: 'EU' });
|
|
239
|
-
const matrix = buildCoverageMatrix(canon, makeConfig({ regimes: undefined }));
|
|
240
|
-
expect(matrix.rows.map(r => r.codexId)).toContain('LAW-GDPR-1');
|
|
241
|
-
expect(matrix.rows.map(r => r.codexId)).toContain('LAW-NIS2-1');
|
|
242
|
-
});
|
|
243
|
-
// ── Backward compat: deprecated config still produces correct matrix ─────────
|
|
244
|
-
it('deprecated scope.codex via parseCoverageMetricConfig maps to correct matrix', () => {
|
|
245
|
-
const r = parseCoverageMetricConfig({
|
|
246
|
-
coverage_metric: {
|
|
247
|
-
id: 'CM-LEGACY',
|
|
248
|
-
name: 'Legacy',
|
|
249
|
-
scope: {
|
|
250
|
-
codex: ['LAW-GDPR-1'],
|
|
251
|
-
subjects: { products: ['PRODUCT-1'] },
|
|
252
|
-
},
|
|
253
|
-
thresholds: { green: 0.8, amber: 0.5 },
|
|
254
|
-
},
|
|
255
|
-
});
|
|
256
|
-
expect(r.ok).toBe(true);
|
|
257
|
-
if (r.ok) {
|
|
258
|
-
const matrix = buildCoverageMatrix(makeCanon(), r.config);
|
|
259
|
-
expect(matrix.rows).toHaveLength(1);
|
|
260
|
-
expect(matrix.rows[0].codexId).toBe('LAW-GDPR-1');
|
|
261
|
-
expect(matrix.rows[0].coveredCount).toBe(2);
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|