From 6f054ca562d847b49544d2cb6e24fc91abede082 Mon Sep 17 00:00:00 2001 From: ache Date: Sun, 3 Mar 2019 02:13:07 +0100 Subject: Init commit --- __tests__/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 __tests__/index.js (limited to '__tests__') diff --git a/__tests__/index.js b/__tests__/index.js new file mode 100644 index 0000000..d1bb986 --- /dev/null +++ b/__tests__/index.js @@ -0,0 +1,22 @@ +'use strict'; + +import remark from 'remark'; +import plugin from '..'; +import test from 'ava'; + +const processor = str => remark().use(plugin).processSync(str); + +const testInfos = [ + {name: 'example', base: '[link](url)', result: '[link](/url)\n'}, + {name: 'local link', base: '[link](/url)', result: '[link](/url)\n'}, + {name: 'auto link', base: '', result: '\n'}, +]; + +testInfos.forEach(testInfo => { + test(testInfo.name, t => { + const {base} = testInfo; + const {result} = testInfo; + t.is(processor(base).contents, result); + }); +}); + -- cgit v1.2.3