aboutsummaryrefslogtreecommitdiff
path: root/__tests__/index.js
blob: d1bb986413438075139c7eb611e26687378dcf8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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: '<http://ache>', result: '<http://ache>\n'},
];

testInfos.forEach(testInfo => {
  test(testInfo.name, t => {
    const {base} = testInfo;
    const {result} = testInfo;
    t.is(processor(base).contents, result);
  });
});