'user strict'; import plugin from '..'; const test = require('ava'); const unified = require('unified'); const raw = require('rehype-raw'); const reParse = require('remark-parse'); const stringify = require('rehype-stringify'); const remark2rehype = require('remark-rehype'); const parse5 = require('parse5'); const render = text => unified() .use(reParse) .use(plugin) .use(remark2rehype) .use(stringify) .processSync(text); const renderRaw = text => unified() .use(reParse) .use(plugin) .use(remark2rehype, {allowDangerousHTML: true}) .use(raw) .use(stringify) .processSync(text); test('simple citation', t => { const {contents} = render('>This is a citation'); t.deepEqual(parse5.parse(contents), parse5.parse('
\n

This is a citation

\n
') ); }); test('simple citation raw', t => { const {contents} = renderRaw('>This is a citation'); t.deepEqual(parse5.parse(contents), parse5.parse('
\n

This is a citation

\n
') ); }); test('question', t => { const {contents} = renderRaw('>!question\nWhat does the šŸ¦Š say ?'); t.deepEqual(parse5.parse(contents), parse5.parse('

What does the šŸ¦Š say ?

')); }); test('attention', t => { const {contents} = renderRaw('>!attention\nBe carefull'); t.deepEqual(parse5.parse(contents), parse5.parse('

Be carefull

')); }); test('good', t => { const {contents} = renderRaw('>!good\nšŸŽ‰'); t.deepEqual(parse5.parse(contents), parse5.parse('

šŸŽ‰

')); }); test('bad', t => { const {contents} = renderRaw('>!bad\nā˜¢ļø'); t.deepEqual(parse5.parse(contents), parse5.parse('

ā˜¢ļø

')); }); test('secret', t => { const {contents} = renderRaw('>!secret Don\'t tell others about it\nšŸ¤«'); t.deepEqual(parse5.parse(contents), parse5.parse('

šŸ¤«

Don\'t tell others about it
')); });