All files / tests index.ts

100% Statements 27/27
100% Branches 2/2
100% Functions 0/0
100% Lines 27/27

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 281x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
import test from 'ava'
import { unified } from 'unified'
import remarkParse from 'remark-parse'
import remark2rehype from 'remark-rehype'
import html from 'rehype-stringify'
import rehypePrism from '../src/index.js'
 
 
test('rehype prism with language', t => {
  const processor = unified()
    .use(remarkParse)
    .use(remark2rehype)
    .use(rehypePrism, { plugins: ['toolbar', 'copy-to-clipboard'] })
    .use(html)
 
  t.snapshot(processor.processSync('```javascript\nconst a = 1\n```\n').value)
})
 
test('rehype prism without language', t => {
  const processor = unified()
    .use(remarkParse)
    .use(remark2rehype)
    .use(rehypePrism, { plugins: ['toolbar', 'copy-to-clipboard'] })
    .use(html)
 
  t.snapshot(processor.processSync('```\nconst a = 1\n```\n').value)
})