aboutsummaryrefslogtreecommitdiff
path: root/__tests__
diff options
context:
space:
mode:
Diffstat (limited to '__tests__')
-rw-r--r--__tests__/__snapshots__/index.js.md12
-rw-r--r--__tests__/__snapshots__/index.js.snapbin0 -> 177 bytes
-rw-r--r--__tests__/index.js39
3 files changed, 51 insertions, 0 deletions
diff --git a/__tests__/__snapshots__/index.js.md b/__tests__/__snapshots__/index.js.md
new file mode 100644
index 0000000..f8a1110
--- /dev/null
+++ b/__tests__/__snapshots__/index.js.md
@@ -0,0 +1,12 @@
+# Snapshot report for `__tests__/index.js`
+
+The actual snapshot is saved in `index.js.snap`.
+
+Generated by [AVA](https://ava.li).
+
+## question
+
+> Snapshot 1
+
+ `<div class="special-box question"><div class="special-box-content"><p>␊
+ What does the 🦊 say ?</p></div></div>`
diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap
new file mode 100644
index 0000000..8728a37
--- /dev/null
+++ b/__tests__/__snapshots__/index.js.snap
Binary files differ
diff --git a/__tests__/index.js b/__tests__/index.js
new file mode 100644
index 0000000..d9fc7fa
--- /dev/null
+++ b/__tests__/index.js
@@ -0,0 +1,39 @@
+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';
+
+import plugin from '../app';
+
+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.is(contents, '<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>');
+});
+
+test('question', t => {
+ const {contents} = renderRaw('>!question\nWhat does the 🦊 say ?');
+ t.snapshot(contents);
+});
+