mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
wip
This commit is contained in:
parent
546cf1c08b
commit
cd4d9f2722
1 changed files with 30 additions and 33 deletions
|
@ -49,46 +49,44 @@ function getMarkdownItFactory(markdownItPlugins) {
|
||||||
}
|
}
|
||||||
|
|
||||||
test("simpleAsync", (t) => new Promise((resolve) => {
|
test("simpleAsync", (t) => new Promise((resolve) => {
|
||||||
|
t.plan(3);
|
||||||
|
const options = {
|
||||||
|
"strings": {
|
||||||
|
"content": "# Heading"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
lintAsync(options, (err, actual) => {
|
||||||
|
t.falsy(err);
|
||||||
|
t.is(actual?.content.length, 1);
|
||||||
|
t.is(actual?.content[0].ruleNames[0], "MD047");
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
|
test("simpleSync", (t) => {
|
||||||
t.plan(2);
|
t.plan(2);
|
||||||
const options = {
|
const options = {
|
||||||
"strings": {
|
"strings": {
|
||||||
"content": "# Heading"
|
"content": "# Heading"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const expected = "content: 1: MD047/single-trailing-newline " +
|
// const expected = "content: 1: MD047/single-trailing-newline " +
|
||||||
"Files should end with a single newline character";
|
// "Files should end with a single newline character";
|
||||||
lintAsync(options, (err, actual) => {
|
const actual = lintSync(options);
|
||||||
t.falsy(err);
|
t.is(actual.content.length, 1);
|
||||||
// @ts-ignore
|
t.is(actual.content[0].ruleNames[0], "MD047");
|
||||||
t.is(actual.toString(), expected, "Unexpected results.");
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
|
|
||||||
test("simpleSync", (t) => {
|
|
||||||
t.plan(1);
|
|
||||||
const options = {
|
|
||||||
"strings": {
|
|
||||||
"content": "# Heading"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const expected = "content: 1: MD047/single-trailing-newline " +
|
|
||||||
"Files should end with a single newline character";
|
|
||||||
const actual = lintSync(options).toString();
|
|
||||||
t.is(actual, expected, "Unexpected results.");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("simplePromise", (t) => {
|
test("simplePromise", (t) => {
|
||||||
t.plan(1);
|
t.plan(2);
|
||||||
const options = {
|
const options = {
|
||||||
"strings": {
|
"strings": {
|
||||||
"content": "# Heading"
|
"content": "# Heading"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const expected = "content: 1: MD047/single-trailing-newline " +
|
|
||||||
"Files should end with a single newline character";
|
|
||||||
return lintPromise(options).then((actual) => {
|
return lintPromise(options).then((actual) => {
|
||||||
t.is(actual.toString(), expected, "Unexpected results.");
|
t.is(actual.content.length, 1);
|
||||||
|
t.is(actual.content[0].ruleNames[0], "MD047");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1281,7 +1279,7 @@ test("token-map-spans", (t) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("configParsersInvalid", async(t) => {
|
test("configParsersInvalid", async(t) => {
|
||||||
t.plan(1);
|
t.plan(2);
|
||||||
const options = {
|
const options = {
|
||||||
"strings": {
|
"strings": {
|
||||||
"content": [
|
"content": [
|
||||||
|
@ -1294,10 +1292,9 @@ test("configParsersInvalid", async(t) => {
|
||||||
].join("\n")
|
].join("\n")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const expected = "content: 1: MD041/first-line-heading/first-line-h1 " +
|
|
||||||
"First line in a file should be a top-level heading [Context: \"Text\"]";
|
|
||||||
const actual = await lintPromise(options);
|
const actual = await lintPromise(options);
|
||||||
t.is(actual.toString(), expected, "Unexpected results.");
|
t.is(actual?.content.length, 1);
|
||||||
|
t.is(actual?.content[0].ruleNames[0], "MD041");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("configParsersJSON", async(t) => {
|
test("configParsersJSON", async(t) => {
|
||||||
|
@ -1317,7 +1314,7 @@ test("configParsersJSON", async(t) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const actual = await lintPromise(options);
|
const actual = await lintPromise(options);
|
||||||
t.is(actual.toString(), "", "Unexpected results.");
|
t.is(actual.content.length, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("configParsersJSONC", async(t) => {
|
test("configParsersJSONC", async(t) => {
|
||||||
|
@ -1339,7 +1336,7 @@ test("configParsersJSONC", async(t) => {
|
||||||
"configParsers": [ jsoncParser.parse ]
|
"configParsers": [ jsoncParser.parse ]
|
||||||
};
|
};
|
||||||
const actual = await lintPromise(options);
|
const actual = await lintPromise(options);
|
||||||
t.is(actual.toString(), "", "Unexpected results.");
|
t.is(actual.content.length, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("configParsersYAML", async(t) => {
|
test("configParsersYAML", async(t) => {
|
||||||
|
@ -1360,7 +1357,7 @@ test("configParsersYAML", async(t) => {
|
||||||
};
|
};
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const actual = await lintPromise(options);
|
const actual = await lintPromise(options);
|
||||||
t.is(actual.toString(), "", "Unexpected results.");
|
t.is(actual.content.length, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("configParsersTOML", async(t) => {
|
test("configParsersTOML", async(t) => {
|
||||||
|
@ -1382,7 +1379,7 @@ test("configParsersTOML", async(t) => {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
const actual = await lintPromise(options);
|
const actual = await lintPromise(options);
|
||||||
t.is(actual.toString(), "", "Unexpected results.");
|
t.is(actual.content.length, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("getVersion", (t) => {
|
test("getVersion", (t) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue