From 5cc6dd928aab776392209cd58012af8bf9a2d2b4 Mon Sep 17 00:00:00 2001 From: ache Date: Mon, 31 Dec 2018 16:05:48 +0100 Subject: More tests --- __tests__/index.js | 52 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 10 deletions(-) (limited to '__tests__') diff --git a/__tests__/index.js b/__tests__/index.js index 5d4c995..d4729df 100644 --- a/__tests__/index.js +++ b/__tests__/index.js @@ -1,11 +1,14 @@ -import test from 'ava'; -import unified from 'unified'; -import raw from 'rehype-raw'; -import reParse from 'remark-parse'; -import stringify from 'rehype-stringify'; -import remark2rehype from 'remark-rehype'; +'user strict'; -import plugin from '../app'; +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) @@ -24,15 +27,44 @@ const renderRaw = text => unified() test('simple citation', t => { const {contents} = render('>This is a citation'); - t.is(contents, '
\n

This is a citation

\n
'); + 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.is(contents, '
\n

This is a citation

\n
'); + 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.snapshot(contents); + 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
')); }); -- cgit v1.2.3