-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const test = require('tape'); | ||
const remark = require('remark'); | ||
const lint = require('remark-lint'); | ||
const alphabetizeLists = require('./'); | ||
|
||
const processor = remark().use(lint).use(alphabetizeLists); | ||
|
||
const nok = `* [An Awesome Book](http://example.com/example.html) | ||
### Example | ||
* [Another Awesome Book](http://example.com/book.html) | ||
* [Some Other Book](http://example.com/other.html) | ||
`; | ||
|
||
const ok = `* [An Awesome Book](http://example.com/example.html) | ||
### Example | ||
* [Another Awesome Book](http://example.com/book.html) | ||
* [Some Other Book](http://example.com/other.html) | ||
`; | ||
|
||
test('remark-lint-alphabetize-lists', (t) => { | ||
t.deepEqual( | ||
processor.processSync(ok).messages.map(String), | ||
[], | ||
'should work on valid fixtures' | ||
); | ||
|
||
t.deepEqual( | ||
processor.processSync(nok).messages.map(String), | ||
[ | ||
'1:1-1:53: Incorrect number of blank lines between last section and next heading', | ||
'3:1-3:12: Incorrect number of blank lines between heading and section' | ||
], | ||
'should work on valid fixtures' | ||
); | ||
|
||
t.end(); | ||
}); |