Skip to content

Commit

Permalink
Comment test for empty section with TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
VadimKovalenkoSNF committed Jul 24, 2023
1 parent ae7a730 commit 460b3fa
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions test/unit/saveArticles.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,38 @@ describe('saveArticles', () => {
dump2 = new Dump('', { keepEmptyParagraphs: true } as any, dump.mwMetaData)
})

test('Found no empty details elements when they should be stripped', async () => {
test('Found no empty paragraph elements when they should be stripped', async () => {
const doc = domino.createDocument(articleHtml)
await applyOtherTreatments(doc, dump)
const paragraphs = Array.from(doc.querySelectorAll('p'))
expect(paragraphs.length).toEqual(2)
})

test('Found empty details elements when they should be left', async () => {
test('Found empty paragraph elements when they should be left', async () => {
const doc = domino.createDocument(articleHtml)
await applyOtherTreatments(doc, dump2)
const paragraphs = Array.from(doc.querySelectorAll('p'))
expect(paragraphs.length).toEqual(4)
})

/*
TODO: Investigate empty section behavior for other endpoints such as page/html and page/mobile html
then rewrite the test below
/
/*
test('Found empty sections when they should be left im desktop view', async () => {
const doc = domino.createDocument(articleHtml)
await applyOtherTreatments(doc, dump2)
const sections = Array.from(doc.querySelectorAll('section'))
let fewestChildren = 0
for (const d of sections) {
if (fewestChildren === 0 || d.children.length < fewestChildren) {
fewestChildren = d.children.length
}
}
expect(fewestChildren).toBeLessThanOrEqual(1)
})
*/
})

test('treatMedias format=""', async () => {
Expand Down

0 comments on commit 460b3fa

Please sign in to comment.