Refactor markdown test to read from file instead of hardcoded strings
This commit is contained in:
parent
1f6c392167
commit
a1e543057f
|
|
@ -1,34 +1,6 @@
|
||||||
import { renderMarkdown } from "./markdown"
|
import { renderMarkdown } from "./markdown"
|
||||||
|
|
||||||
const lines = [
|
const file = Bun.file("test/MARKDOWN.md")
|
||||||
"This is **bold** text",
|
const content = await file.text()
|
||||||
"This is *italic* text",
|
|
||||||
"This is `inline code` text",
|
|
||||||
"Mix of **bold**, *italic*, and `code` in one line",
|
|
||||||
"**bold with `code` inside** bold",
|
|
||||||
"No markdown here",
|
|
||||||
"Multiple **bold one** and **bold two**",
|
|
||||||
"Nested-ish: **bold and *italic* together**",
|
|
||||||
]
|
|
||||||
|
|
||||||
for (const line of lines) {
|
console.log(renderMarkdown(content))
|
||||||
console.log(` ${line}`)
|
|
||||||
console.log(` ${renderMarkdown(line)}`)
|
|
||||||
console.log()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Code fence tests
|
|
||||||
console.log("--- Code fence tests ---")
|
|
||||||
const fenceTests = [
|
|
||||||
"Here is some code:\n```typescript\nconst x = 1\n```\nDone.",
|
|
||||||
"```\nhello\n```",
|
|
||||||
"```js\nconsole.log('hi')\n```",
|
|
||||||
]
|
|
||||||
|
|
||||||
for (const test of fenceTests) {
|
|
||||||
console.log("INPUT:")
|
|
||||||
console.log(test)
|
|
||||||
console.log("OUTPUT:")
|
|
||||||
console.log(renderMarkdown(test))
|
|
||||||
console.log()
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user