Skip to content

Commit

Permalink
fix(informative test): #205 add await to check branches, add addition…
Browse files Browse the repository at this point in the history
…al test for informativeTest_6_3_8
  • Loading branch information
rainer-exxcellent committed Feb 26, 2025
1 parent 4696fd6 commit 1ea27f6
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/informativeTests/informativeTest_6_3_8.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export default async function informativeTest_6_3_8(
`${prefix}${branchIndex}/product/name`,
branch.product?.name
)
checkBranches(
await checkBranches(
`${prefix}${branchIndex}/branches/`,
Array.isArray(branch.branches) ? branch.branches : []
)
Expand Down
10 changes: 8 additions & 2 deletions tests/informativeTest_6_3_8.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { expect } from 'chai'
import informativeTest_6_3_8 from '../lib/informativeTests/informativeTest_6_3_8.js'
import readExampleFiles from './shared/readExampleFiles.js'

const validString = "Informative test: Spell check (failing example 2, Check branches)"

const failingExamples = await readExampleFiles(
new URL('informativeTest_6_3_8/failing', import.meta.url)
)
Expand All @@ -11,8 +13,12 @@ describe('Informative test 6.3.8', function () {
for (const [title, failingExample] of failingExamples) {
it(title, async function () {
const result = await informativeTest_6_3_8(failingExample, {
async hunspell() {
return 'Hunspell vMOCK\n\n# wrongword 1'
async hunspell({ dictionary, input }) {
if (validString === input) {
return 'Hunspell vMOCK\n\n*'
} else {
return 'Hunspell vMOCK\n\n# wrongword 1'
}
},
})

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"document": {
"category": "csaf_base",
"csaf_version": "2.0",
"lang": "en",
"publisher": {
"category": "other",
"namespace": "https://csaf.io"
},
"title": "Informative test: Spell check (failing example 2, Check branches)",
"tracking": {
"current_release_date": "2021-07-21T10:00:00.000Z",
"id": "OASIS_CSAF_TC-CSAF_2.0-2021-6-3-08-01",
"initial_release_date": "2021-07-21T10:00:00.000Z",
"revision_history": [
{
"date": "2021-07-21T10:00:00.000Z",
"number": "1"
}
],
"status": "final",
"version": "1"
}
},
"product_tree": {
"branches": [
{
"branches": [
{
"branches": [
{
"category": "product_name",
"name": "Red Hat Enterprise Linux Client (v. 7)",
"product": {
"name": "Red Hat Enterprise Linux Client (v. 7)",
"product_id": "7Client-7.6",
"product_identification_helper": {
"cpe": "cpe:/o:redhat:enterprise_linux:7::client"
}
}
}
]
}
]
}
]
}
}

0 comments on commit 1ea27f6

Please sign in to comment.