2021-12-17 02:15:13 +00:00
|
|
|
// @ts-check
|
|
|
|
|
2024-11-28 20:36:44 -08:00
|
|
|
import fs from "node:fs";
|
|
|
|
import path from "node:path";
|
|
|
|
import test from "ava";
|
|
|
|
import markdownlint from "../lib/markdownlint.mjs";
|
2021-12-17 02:15:13 +00:00
|
|
|
|
|
|
|
// Simulates typing each test file to validate handling of partial input
|
2022-06-08 22:10:27 -07:00
|
|
|
const files = fs
|
|
|
|
.readdirSync("./test")
|
|
|
|
.filter((file) => /\.md$/.test(file));
|
|
|
|
for (const file of files) {
|
2021-12-17 02:15:13 +00:00
|
|
|
const strings = {};
|
|
|
|
let content = fs.readFileSync(path.join("./test", file), "utf8");
|
|
|
|
while (content) {
|
|
|
|
strings[content.length.toString()] = content;
|
|
|
|
content = content.slice(0, -1);
|
|
|
|
}
|
2023-12-31 21:51:34 -08:00
|
|
|
test.serial(`type ${file}`, (t) => {
|
2021-12-17 02:15:13 +00:00
|
|
|
t.plan(1);
|
|
|
|
markdownlint.sync({
|
|
|
|
// @ts-ignore
|
|
|
|
strings,
|
|
|
|
"resultVersion": 0
|
|
|
|
});
|
|
|
|
t.pass();
|
|
|
|
});
|
2022-06-08 22:10:27 -07:00
|
|
|
}
|