mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Add a test for micromark helpers filterByPredicate and filterByTypes to ensure they return the same token lists for "all tokens".
This commit is contained in:
parent
af91dbfed9
commit
e282874fe3
1 changed files with 9 additions and 0 deletions
|
|
@ -45,3 +45,12 @@ test("filterByTypes", async(t) => {
|
|||
t.true(token.type.endsWith("Text"));
|
||||
}
|
||||
});
|
||||
|
||||
test("filterByPredicate/filterByTypes", async(t) => {
|
||||
t.plan(1);
|
||||
const tokens = await testTokens;
|
||||
const byPredicate = filterByPredicate(tokens, () => true);
|
||||
const allTypes = new Set(byPredicate.map(((token) => token.type)));
|
||||
const byTypes = filterByTypes(tokens, [ ...allTypes.values() ]);
|
||||
t.deepEqual(byPredicate, byTypes);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue