Add snapshot test for markdownit token params passed to custom rules.

This commit is contained in:
David Anson 2024-09-12 22:52:30 -07:00
parent d279c4e424
commit bdd5cdcafe
4 changed files with 3092 additions and 2 deletions

View file

@ -622,7 +622,7 @@ test("customRulesParserMicromark", (t) => {
});
});
test("customRulesParamsTokensSameObject", (t) => {
test("customRulesMarkdownItParamsTokensSameObject", (t) => {
t.plan(1);
// eslint-disable-next-line jsdoc/valid-types
/** @type import("../lib/markdownlint").Options */
@ -647,6 +647,29 @@ test("customRulesParamsTokensSameObject", (t) => {
return markdownlint.promises.markdownlint(options).then(() => null);
});
test("customRulesMarkdownItTokensSnapshot", (t) => {
t.plan(1);
// eslint-disable-next-line jsdoc/valid-types
/** @type import("../lib/markdownlint").Options */
const options = {
"customRules": [
{
"names": [ "name" ],
"description": "description",
"tags": [ "tag" ],
"parser": "markdownit",
"function":
(params) => {
t.snapshot(params.parsers.markdownit.tokens, "Unexpected tokens");
}
}
],
"files": "./test/every-markdown-syntax.md",
"noInlineConfig": true
};
return markdownlint.promises.markdownlint(options).then(() => null);
});
test("customRulesDefinitionStatic", (t) => new Promise((resolve) => {
t.plan(2);
// eslint-disable-next-line jsdoc/valid-types

File diff suppressed because it is too large Load diff

Binary file not shown.