File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 11import assert from 'node:assert/strict'
22import { mandatoryTest_6_1_47 } from '../../csaf_2_1/mandatoryTests/mandatoryTest_6_1_47.js'
3+ import { expect } from 'chai'
4+
5+ const validInputSchemaTestWithEmptyVulnerability6_1_47 = {
6+ vulnerabilities : [
7+ { } , // even this vulnerability is empty, the test should not fail due to the inputSchema
8+ {
9+ cve : 'CVE-1900-0001' ,
10+ metrics : [
11+ {
12+ content : {
13+ ssvc_v1 : {
14+ id : 'CVE-1900-0001' ,
15+ schemaVersion : '1-0-1' ,
16+ selections : [
17+ {
18+ name : 'Exploitation' ,
19+ namespace : 'ssvc' ,
20+ values : [ 'None' ] ,
21+ version : '1.1.0' ,
22+ } ,
23+ ] ,
24+ timestamp : '2024-01-24T10:00:00.000Z' ,
25+ } ,
26+ } ,
27+ products : [ 'CSAFPID-9080700' ] ,
28+ } ,
29+ ] ,
30+ } ,
31+ ] ,
32+ }
333
434describe ( 'mandatoryTest_6_1_47' , function ( ) {
535 it ( 'only runs on relevant documents' , function ( ) {
636 assert . equal ( mandatoryTest_6_1_47 ( { document : 'mydoc' } ) . isValid , true )
737 } )
38+ it ( 'test input schema with empty json object in vulnerabilities' , async function ( ) {
39+ const result = mandatoryTest_6_1_47 (
40+ validInputSchemaTestWithEmptyVulnerability6_1_47
41+ )
42+ expect ( result . errors . length ) . to . eq ( 0 )
43+ } )
844} )
You can’t perform that action at this time.
0 commit comments