-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1063 added unit tests for validation for records with ADP containers
- Loading branch information
1 parent
2b28096
commit 7e556f6
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) | ||
}) |