Skip to content

Commit

Permalink
#1063 added unit tests for validation for records with ADP containers
Browse files Browse the repository at this point in the history
  • Loading branch information
jdaigneau5 committed May 30, 2023
1 parent 2b28096 commit 7e556f6
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/unit-tests/cve/validateCveWithAdpTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const chai = require('chai')
const expect = chai.expect
const _ = require('lodash')
const cveRecordPublished = require('../../schemas/5.0/CVE-2017-4024_published.json')

const Cve = require('../../../src/model/cve')
const cveCopy = _.cloneDeep(cveRecordPublished)

describe('Testing validating CVE record that has an ADP container', () => {
it('Should return TRUE for valid Cve record ADP container', () => {
const validationObj = Cve.validateCveRecord(cveCopy)

expect(validationObj.isValid).to.be.equal(true)
})

it('Should return FALSE for Cve record with invalid ADP container', () => {
// providerMetadata is a required adpContainer field, so validation will fail
delete cveCopy.containers.adp[0].providerMetadata

const validationObj = Cve.validateCveRecord(cveCopy)
expect(validationObj.isValid).to.be.equal(false)
})
})

0 comments on commit 7e556f6

Please sign in to comment.