Skip to content
Open
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_43.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const inputSchema = /** @type {const} */ ({
full_product_names: {
elements: fullProductNameSchema,
},
relationships: {
product_paths: {
elements: {
additionalProperties: true,
optionalProperties: {
Expand Down Expand Up @@ -139,11 +139,11 @@ export function mandatoryTest_6_1_43(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
83 changes: 83 additions & 0 deletions tests/csaf_2_1/mandatoryTest_6_1_43.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,87 @@ describe('mandatoryTest_6_1_43', function () {
})
})
})

it('validates branches and skips invalid ones', function () {
assert.equal(
mandatoryTest_6_1_43({
product_tree: {
branches: [
{
product: {
product_identification_helper: {
model_numbers: ['*P\\*\\*?\\*'],
},
},
branches: [
{
product: 'invalid',
},
{
branches: [{}],
},
],
},
],
},
}).isValid,
true
)
})

it('validates product_paths and skips invalid ones', function () {
assert.equal(
mandatoryTest_6_1_43({
product_tree: {
product_paths: [
{
full_product_name: {
model_numbers: ['*P\\*\\*?\\*'],
},
},
{},
],
},
}).isValid,
true
)
})

it('detects invalid model numbers in branches', function () {
assert.equal(
mandatoryTest_6_1_43({
product_tree: {
branches: [
{
product: {
product_identification_helper: {
model_numbers: ['P*A*'],
},
},
},
],
},
}).isValid,
false
)
})

it('detects invalid model numbers in product_paths', function () {
assert.equal(
mandatoryTest_6_1_43({
product_tree: {
product_paths: [
{
full_product_name: {
product_identification_helper: {
model_numbers: ['P*A*'],
},
},
},
],
},
}).isValid,
false
)
})
})
Loading