From e282874fe3ca164ccae0e6284d6003cde2176464 Mon Sep 17 00:00:00 2001 From: David Anson Date: Wed, 30 Aug 2023 22:34:21 -0700 Subject: [PATCH] Add a test for micromark helpers filterByPredicate and filterByTypes to ensure they return the same token lists for "all tokens". --- test/markdownlint-test-micromark.mjs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/markdownlint-test-micromark.mjs b/test/markdownlint-test-micromark.mjs index ca78f293..011c34da 100644 --- a/test/markdownlint-test-micromark.mjs +++ b/test/markdownlint-test-micromark.mjs @@ -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); +});