Assessor_2.0/tests/features/results-browser-cve-enrichm...

26 lines
1.0 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { shouldShowNvdDescription } from '../../src/features/results-browser/ResultsBrowser';
describe('Result DB CVE enrichment', () => {
it('does not repeat the NVD description when the scanner already supplied it', () => {
expect(shouldShowNvdDescription(
'The same vulnerability description is already present.',
' The same vulnerability description\n is already present. '
)).toBe(false);
});
it('ignores invisible Unicode, case, and punctuation differences in equivalent descriptions', () => {
expect(shouldShowNvdDescription(
'Wind River VxWorks 6.7 though 6.9 and vx7 has a Buffer Over\u00adflow in the TCP component (issue 3 of 4).',
'wind river vxworks 6.7 though 6.9 and VX7 has a buffer overflow in the TCP component — issue 3 of 4.'
)).toBe(false);
});
it('keeps a distinct NVD description visible', () => {
expect(shouldShowNvdDescription(
'Scanner-provided description.',
'NVD provides different details.'
)).toBe(true);
});
});