aboutsummaryrefslogtreecommitdiff
path: root/__tests__
diff options
context:
space:
mode:
authorache <ache@ache.one>2018-12-31 16:05:48 +0100
committerache <ache@ache.one>2018-12-31 16:05:48 +0100
commit5cc6dd928aab776392209cd58012af8bf9a2d2b4 (patch)
tree25a8f7e9fa1129a749da31307d9a565b15e0bf0b /__tests__
parentDist file (diff)
More tests
Diffstat (limited to '__tests__')
-rw-r--r--__tests__/index.js52
1 files changed, 42 insertions, 10 deletions
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, '<blockquote>\n<p>This is a citation</p>\n</blockquote>');
+ t.deepEqual(parse5.parse(contents),
+ parse5.parse('<blockquote>\n<p>This is a citation</p>\n</blockquote>')
+ );
});
test('simple citation raw', t => {
const {contents} = renderRaw('>This is a citation');
- t.is(contents, '<blockquote>\n<p>This is a citation</p>\n</blockquote>');
+ t.deepEqual(parse5.parse(contents),
+ parse5.parse('<blockquote>\n<p>This is a citation</p>\n</blockquote>')
+ );
});
test('question', t => {
const {contents} = renderRaw('>!question\nWhat does the šŸ¦Š say ?');
- t.snapshot(contents);
+ t.deepEqual(parse5.parse(contents),
+ parse5.parse('<div class="special-box question"><div class="special-box-content"><p>What does the šŸ¦Š say ?</p></div></div>'));
+});
+
+test('attention', t => {
+ const {contents} = renderRaw('>!attention\nBe carefull');
+ t.deepEqual(parse5.parse(contents),
+ parse5.parse('<div class="special-box attention"><div class="special-box-content"><p>Be carefull</p></div></div>'));
+});
+
+test('good', t => {
+ const {contents} = renderRaw('>!good\nšŸŽ‰');
+ t.deepEqual(parse5.parse(contents),
+ parse5.parse('<div class="special-box good"><div class="special-box-content"><p>šŸŽ‰</p></div></div>'));
+});
+
+test('bad', t => {
+ const {contents} = renderRaw('>!bad\nā˜¢ļø');
+ t.deepEqual(parse5.parse(contents),
+ parse5.parse('<div class="special-box bad"><div class="special-box-content"><p>ā˜¢ļø</p></div></div>'));
+});
+
+test('secret', t => {
+ const {contents} = renderRaw('>!secret Don\'t tell others about it\nšŸ¤«');
+ t.deepEqual(parse5.parse(contents),
+ parse5.parse('<details class="special-box secret"><div><p>šŸ¤«</p></div><summary>Don\'t tell others about it</summary></details>'));
});