Skip to content

Commit

Permalink
test: fix test by not ignoring other inlineText tokenizers
Browse files Browse the repository at this point in the history
  • Loading branch information
baarcker committed Apr 8, 2024
1 parent a87f042 commit d3948a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions packages/nuekit/test/nuekit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,18 +333,19 @@ test('marked extension config file', async() => {
const marked_config = `export default [{
tokenizer: {
inlineText(src) {
const text = src.replace(/\\.{3}/g, '\\u2026')
return { type: 'text', raw: src, text }
const cap = this.rules.inline.text.exec(src)
const text = cap[0].replace(/\\.{3}/g, '\\u2026')
return { type: 'text', raw: cap[0], text }
}
}
}]`

await write('marked.config.js', marked_config)
await write('index.md', 'This is a test, right?\n\n...\n\nRight?\n\n.....')

const kit = await getKit()
const html = await kit.gen('index.md')

const ellipsis = '…'
expect(html).toInclude(`<p>This is a test, right?</p>\n<p>${ellipsis}</p>\n<p>Right?</p>\n<p>${ellipsis}..</p>\n`)

Check failure on line 350 in packages/nuekit/test/nuekit.test.js

View workflow job for this annotation

GitHub Actions / test (ubuntu-22.04, bun)

error: expect(received).toInclude(expected)

Expected to include: "<p>This is a test, right?</p>\n<p>&#x2026;</p>\n<p>Right?</p>\n<p>&#x2026;..</p>\n" Received: "<!doctype html>\n\n<html lang=\"en\" dir=\"ltr\">\n\n <head>\n <meta charset=\"utf-8\">\n<meta name=\"generator\" content=\"Nue vundefined (nuejs.org)\">\n<meta name=\"date.updated\" content=\"2024-04-08T13:12:36.305Z\">\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n<script src=\"/@nue/hotreload.js\" type=\"module\"></script>\n \n </head>\n\n <body>\n \n <p>This is a test, right?</p>\n<p>...</p>\n<p>Right?</p>\n<p>.....</p>\n\n \n </body>\n\n</html>" at /home/runner/work/nue/nue/packages/nuekit/test/nuekit.test.js:350:3
})
5 changes: 3 additions & 2 deletions packages/nuemark/test/nuemark.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,9 @@ test('marked extension', async () => {
const marked_extensions = [{
tokenizer: {
inlineText(src) {
const text = src.replace(/\.{3}/g, ellipsis)
return { type: 'text', raw: src, text }
const cap = this.rules.inline.text.exec(src)
const text = cap[0].replace(/\.{3}/g, ellipsis)
return { type: 'text', raw: cap[0], text }
}
}
}]
Expand Down

0 comments on commit d3948a3

Please sign in to comment.