mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
More SSML test cases
This commit is contained in:
parent
c85e6370b1
commit
0236f2b675
1 changed files with 62 additions and 0 deletions
|
|
@ -29,6 +29,36 @@ describe('htmlToSsml', () => {
|
|||
)
|
||||
})
|
||||
})
|
||||
describe('escaping', () => {
|
||||
it('should convert to spaces', async () => {
|
||||
const ssml = htmlToSsml(`
|
||||
<div id="readability-content">
|
||||
<div id="readability-page-1">
|
||||
<p>some space</p>
|
||||
</div>
|
||||
</div>
|
||||
`, TEST_OPTIONS
|
||||
)
|
||||
const text = ssml[0].textItems.join('').trim()
|
||||
expect(text).to.equal(
|
||||
`<p><bookmark mark="3" />some space</p>`
|
||||
)
|
||||
})
|
||||
it('should remove emojis', async () => {
|
||||
const ssml = htmlToSsml(`
|
||||
<div id="readability-content">
|
||||
<div id="readability-page-1">
|
||||
<p>no emoji here 🙏🙏</p>
|
||||
</div>
|
||||
</div>
|
||||
`, TEST_OPTIONS
|
||||
)
|
||||
const text = ssml[0].textItems.join('').trim()
|
||||
expect(text).to.equal(
|
||||
`<p><bookmark mark="3" />no emoji here </p>`
|
||||
)
|
||||
})
|
||||
})
|
||||
describe('a file with nested elements', () => {
|
||||
it('should collapse spans into the parent paragraph', async () => {
|
||||
const ssml = htmlToSsml(`
|
||||
|
|
@ -178,6 +208,38 @@ describe('htmlToSsml', () => {
|
|||
)
|
||||
})
|
||||
})
|
||||
describe('a file with lists', () => {
|
||||
it('should convert a ul to <p> and <s>', async () => {
|
||||
const ssml = htmlToSsml(`
|
||||
<div id="readability-content">
|
||||
<div>
|
||||
<ul><li>first item</li><li>second item</li></ul>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
`, TEST_OPTIONS
|
||||
)
|
||||
const text = ssml[0].textItems.join('').trim()
|
||||
expect(text).to.equal(
|
||||
`<p><s>first item</s><s>second item</s></p>`.trim()
|
||||
)
|
||||
})
|
||||
it('should convert a ol to <p> and <s>', async () => {
|
||||
const ssml = htmlToSsml(`
|
||||
<div id="readability-content">
|
||||
<div>
|
||||
<ol><li>first item</li><li>second item</li></ol>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
`, TEST_OPTIONS
|
||||
)
|
||||
const text = ssml[0].textItems.join('').trim()
|
||||
expect(text).to.equal(
|
||||
`<p><s>first item</s><s>second item</s></p>`.trim()
|
||||
)
|
||||
})
|
||||
})
|
||||
// For local testing:
|
||||
// describe('readability test files', () => {
|
||||
// it('should convert Html to SSML without throwing', async () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue