feat(config-audit): export WEIGHTS from severity.mjs (v5 F3 prep)
Promote WEIGHTS const to named export with Object.freeze for downstream use in scoring.mjs (severity-weighted scoreByArea, F3). Tests: +2 cases asserting WEIGHTS shape.
This commit is contained in:
parent
62a9335772
commit
e5efc2ff64
2 changed files with 15 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, it } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { SEVERITY, riskScore, verdict, riskBand, gradeFromPassRate, QUALITY_CATEGORIES } from '../../scanners/lib/severity.mjs';
|
||||
import { SEVERITY, WEIGHTS, riskScore, verdict, riskBand, gradeFromPassRate, QUALITY_CATEGORIES } from '../../scanners/lib/severity.mjs';
|
||||
|
||||
describe('SEVERITY constants', () => {
|
||||
it('has all 5 levels', () => {
|
||||
|
|
@ -12,6 +12,19 @@ describe('SEVERITY constants', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('WEIGHTS named export (v5 F3 prep)', () => {
|
||||
it('exposes critical=25', () => {
|
||||
assert.strictEqual(WEIGHTS.critical, 25);
|
||||
});
|
||||
|
||||
it('exposes high=10, medium=4, low=1, info=0', () => {
|
||||
assert.strictEqual(WEIGHTS.high, 10);
|
||||
assert.strictEqual(WEIGHTS.medium, 4);
|
||||
assert.strictEqual(WEIGHTS.low, 1);
|
||||
assert.strictEqual(WEIGHTS.info, 0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('riskScore', () => {
|
||||
it('returns 0 for empty counts', () => {
|
||||
assert.strictEqual(riskScore({}), 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue