Skip to content

Commit

Permalink
Added a test disallowing the presence of text nodes in root
Browse files Browse the repository at this point in the history
  • Loading branch information
marekdedic committed May 15, 2023
1 parent aa36359 commit 2eb474c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ test('remarkUnwrapImages', (t) => {
'should unwrap multiple images'
)

const processor = remark().use(remarkUnwrapImages)
t.deepEqual(
processor.runSync(processor.parse('![alpha](alpha.png) ![bravo](bravo.png)')),
{ type: 'root', children: [ { type: 'image', title: null, url: 'alpha.png', alt: 'alpha', position: { start: { line: 1, column: 1, offset: 0 }, end: { line: 1, column: 20, offset: 19 } } }, { type: 'image', title: null, url: 'bravo.png', alt: 'bravo', position: { start: { line: 1, column: 21, offset: 20 }, end: { line: 1, column: 40, offset: 39 } } } ], position: { start: { line: 1, column: 1, offset: 0 }, end: { line: 1, column: 40, offset: 39 } } },
'should not put text nodes in root'
)

t.equal(
remark()
.use(remarkUnwrapImages)
Expand Down

0 comments on commit 2eb474c

Please sign in to comment.