-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
51 lines (43 loc) · 1.4 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const test = require('tape');
const remark = require('remark');
const lint = require('remark-lint');
const booksLinks = require('./');
const processor = remark().use(lint).use(booksLinks);
const author = `* [Another Awesome Book](http://example.com/book.html)- John Doe
* [Another Awesome Book](http://example.com/book.html) - John Doe
`;
const format = `* [Another Awesome Book](http://example.com/book.pdf)(PDF)
* [Another Awesome Book](http://example.com/book.pdf)
* [Another Awesome Book](http://example.com/book.pdf) (PDF)
`;
const authorAndFormat = `* [Another Awesome Book](http://example.com/book.pdf)- John Doe
* [Another Awesome Book](http://example.com/book.pdf) - John Doe
* [Another Awesome Book](http://example.com/book.pdf) - John Doe (PDF)
`;
test('remark-lint-alphabetize-lists', (t) => {
t.deepEqual(
processor.processSync(author).messages.map(String),
[
'1:3-1:65: Missing a space before author'
],
'author'
);
t.deepEqual(
processor.processSync(format).messages.map(String),
[
'1:3-1:59: Missing a space before PDF indication',
'2:3-2:54: Missing PDF indication'
],
'format'
);
t.deepEqual(
processor.processSync(authorAndFormat).messages.map(String),
[
'1:3-1:64: Missing a space before author',
'1:3-1:64: Missing PDF indication',
'2:3-2:65: Missing PDF indication'
],
'author and format'
);
t.end();
});