Skip to content

Commit ed07c1b

Browse files
feat(CSAF2.1): #403 add recommended test 6.2.39.2 - improve tests and comments in language lib
1 parent 9b3d4e6 commit ed07c1b

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

lib/shared/languageSpecificTranslation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const translationMap = new Map(
1212
* Checks if the document language is specified and not English
1313
*
1414
* @param {string | undefined} language - The language expression to check
15-
* @returns {boolean} True if the language is valid, false otherwise
15+
* @returns {boolean} False if language is English, true if the language is valid, false otherwise
1616
*/
1717
export function isLangSpecifiedAndNotEnglish(language) {
1818
return (

tests/csaf_2_1/recommendedTest_6_2_39_2.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,25 @@ describe('recommendedTest_6_2_39_2', function () {
88
assert.equal(recommendedTest_6_2_39_2({}).warnings.length, 0)
99
})
1010

11-
it('only runs on valid language', function () {
12-
assert.equal(
13-
recommendedTest_6_2_39_2({
14-
document: { lang: '123', license_expression: 'MIT' },
15-
}).warnings.length,
16-
0
17-
)
11+
it('only runs on valid category', function () {
12+
const result = recommendedTest_6_2_39_2({
13+
document: { category: '123', license_expression: 'MIT' },
14+
})
15+
16+
assert.equal(result.warnings.length, 0)
17+
assert.equal(result.infos.length, 0)
18+
})
19+
20+
it('info on invalid language', function () {
21+
const result = recommendedTest_6_2_39_2({
22+
document: {
23+
category: 'csaf_withdrawn',
24+
lang: '123',
25+
license_expression: 'MIT',
26+
},
27+
})
28+
assert.equal(result.warnings.length, 0)
29+
assert.equal(result.infos.length, 1)
1830
})
1931

2032
it('check get ReasoningForWithdrawal in document lang', function () {

0 commit comments

Comments
 (0)