-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test using some canonical lists (#142)
Co-authored-by: Sindre Sorhus <[email protected]>
- Loading branch information
1 parent
e8840c7
commit 1c46742
Showing
5 changed files
with
59 additions
and
1 deletion.
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,6 @@ | ||
[submodule "test/canonical/awesome-nodejs"] | ||
path = test/canonical/awesome-nodejs | ||
url = https://github.com/sindresorhus/awesome-nodejs.git | ||
[submodule "test/canonical/awesome"] | ||
path = test/canonical/awesome | ||
url = https://github.com/sindresorhus/awesome.git |
Submodule awesome-nodejs
added at
94bb62
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,44 @@ | ||
import test from 'ava'; | ||
import lint from '..'; | ||
import findReadmeFile from '../lib/find-readme-file'; | ||
|
||
/** | ||
Verify there are no `VMessages` in the `VFile`, except for certain rule IDs. | ||
@param {import('ava').ExecutionContext} t - AVA test context. | ||
@param {VFile} vFile - `VFile` with a list of messages. | ||
@param {string[]} expectedRuleIds - Rule IDs for messages you expect to see. | ||
*/ | ||
function noUnwantedVMessages(t, vFile, expectedRuleIds) { | ||
const seenRules = new Set(vFile.messages.map(vMessage => vMessage.ruleId)); | ||
|
||
t.deepEqual([...seenRules], expectedRuleIds); | ||
} | ||
|
||
test('awesome', async t => { | ||
const [readme, codeOfConduct] = await lint({filename: findReadmeFile('test/canonical/awesome')}); | ||
|
||
noUnwantedVMessages(t, readme, [ | ||
'match-punctuation', | ||
'awesome-heading' | ||
]); | ||
|
||
noUnwantedVMessages(t, codeOfConduct, [ | ||
'awesome-code-of-conduct' | ||
]); | ||
}); | ||
|
||
test('awesome-nodejs', async t => { | ||
const [readme, codeOfConduct] = await lint({filename: findReadmeFile('test/canonical/awesome-nodejs')}); | ||
|
||
noUnwantedVMessages(t, readme, [ | ||
'match-punctuation', | ||
'double-link', | ||
'awesome-heading', | ||
'awesome-list-item' | ||
]); | ||
|
||
noUnwantedVMessages(t, codeOfConduct, [ | ||
'awesome-code-of-conduct' | ||
]); | ||
}); |