Skip to content

Commit

Permalink
test: add more edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Jun 9, 2022
1 parent 5c9d8c4 commit d473116
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions test/features/parser-markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ export const testMarkdownParser = () => {
content: [
':hello', // valid
':hello,', // valid
':hello-world', // valid but with different name
':hello :hello', // valid
':hello{}-world', // valid
':hello:hello', // invalid
':hello-world', // valid but with different name
':hello:', // invalid
'`:hello`', // code
':rocket:' // emoji
].join('\n')
}
Expand All @@ -90,7 +93,14 @@ export const testMarkdownParser = () => {
visit(parsed.body, node => (node as any).tag === 'hello', () => {
compComponentCount += 1
})
expect(compComponentCount).toEqual(3)
expect(compComponentCount).toEqual(5)

const paragraph = parsed.body.children[0]
expect(paragraph.children[0].tag).toEqual('hello')
expect(paragraph.children[1].tag).toEqual('hello')
expect(paragraph.children[3].tag).toEqual('hello')
expect(paragraph.children[5].tag).toEqual('hello')
expect(paragraph.children[6].tag).toEqual('hello')

// Check conflict between inline compoenent and emoji
expect(parsed.body.children[0].children.pop().value).toContain('🚀')
Expand Down

0 comments on commit d473116

Please sign in to comment.