Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions csaf_2_1/mandatoryTests/mandatoryTest_6_1_42.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const inputSchema = /** @type {const} */ ({
full_product_names: {
elements: fullProductNameSchema,
},
relationships: {
product_paths: {
elements: {
additionalProperties: true,
optionalProperties: {
Expand Down Expand Up @@ -168,11 +168,11 @@ export function mandatoryTest_6_1_42(doc) {
)
})

doc.product_tree?.relationships?.forEach((relationship, index) => {
const fullProductName = relationship.full_product_name
doc.product_tree?.product_paths?.forEach((productPath, index) => {
const fullProductName = productPath.full_product_name
if (fullProductName) {
checkFullProductName(
`/product_tree/relationships/${index}/full_product_name`,
`/product_tree/product_paths/${index}/full_product_name`,
fullProductName
)
}
Expand Down
20 changes: 20 additions & 0 deletions tests/csaf_2_1/mandatoryTest_6_1_42.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ describe('mandatoryTest_6_1_42', function () {
assert.equal(mandatoryTest_6_1_42({ product_tree: 'mydoc' }).isValid, true)
})

it('validates product_paths and skips invalid ones', function () {
assert.equal(
mandatoryTest_6_1_42({
product_tree: {
product_paths: [
{
full_product_name: {
purls: [
'pkg:oci/product-A@sha256%3Add134261219b2?repository_url=https://registry.example.com',
],
},
},
{},
],
},
}).isValid,
true
)
})

it('test checkPurls', function () {
expect(checkPurls([]), 'empty purl array').to.eql([])
expect(checkPurls(['invalid']), 'invalid PURL').to.eql([])
Expand Down
Loading