mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-11 22:36:59 +10:00
32 lines
850 B
TypeScript
32 lines
850 B
TypeScript
import parseHeaders from '../src/parseHeaders'
|
|
|
|
describe('parseHeaders', () => {
|
|
test('should unescape html', () => {
|
|
const input = '<div>'
|
|
expect(parseHeaders(input)).toBe('<div>')
|
|
})
|
|
|
|
test('should remove markdown tokens correctly', () => {
|
|
const asserts: Record<string, string> = {
|
|
// #238
|
|
'[vue](vuejs.org)': 'vue',
|
|
'`vue`': 'vue',
|
|
'*vue*': 'vue',
|
|
'**vue**': 'vue',
|
|
'***vue***': 'vue',
|
|
'_vue_': 'vue',
|
|
'\\_vue\\_': '_vue_',
|
|
'\\*vue\\*': '*vue*',
|
|
'\\!vue\\!': '!vue!',
|
|
|
|
// #564 For multiple markdown tokens
|
|
'`a` and `b`': 'a and b',
|
|
'***bold and italic***': 'bold and italic',
|
|
'**bold** and *italic*': 'bold and italic'
|
|
}
|
|
Object.keys(asserts).forEach(input => {
|
|
expect(parseHeaders(input)).toBe(asserts[input])
|
|
})
|
|
})
|
|
})
|