mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Duplicate test markdownlint-test-extra.js to markdownlint-test-extra-type.js and markdownlint-test-extra-parse.js for splitting.
This commit is contained in:
parent
ecf42ad7f5
commit
442dcfe5b8
2 changed files with 82 additions and 0 deletions
41
test/markdownlint-test-extra-parse.js
Normal file
41
test/markdownlint-test-extra-parse.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
// @ts-check
|
||||
|
||||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const globby = require("globby");
|
||||
const test = require("ava").default;
|
||||
const markdownlint = require("../lib/markdownlint");
|
||||
|
||||
// Simulates typing each test file to validate handling of partial input
|
||||
const files = fs.readdirSync("./test");
|
||||
files.filter((file) => /\.md$/.test(file)).forEach((file) => {
|
||||
const strings = {};
|
||||
let content = fs.readFileSync(path.join("./test", file), "utf8");
|
||||
while (content) {
|
||||
strings[content.length.toString()] = content;
|
||||
content = content.slice(0, -1);
|
||||
}
|
||||
test(`type ${file}`, (t) => {
|
||||
t.plan(1);
|
||||
markdownlint.sync({
|
||||
// @ts-ignore
|
||||
strings,
|
||||
"resultVersion": 0
|
||||
});
|
||||
t.pass();
|
||||
});
|
||||
});
|
||||
|
||||
// Parses all Markdown files in all package dependencies
|
||||
test.cb("parseAllFiles", (t) => {
|
||||
t.plan(1);
|
||||
const options = {
|
||||
"files": globby.sync("**/*.{md,markdown}")
|
||||
};
|
||||
markdownlint(options, (err) => {
|
||||
t.falsy(err);
|
||||
t.end();
|
||||
});
|
||||
});
|
41
test/markdownlint-test-extra-type.js
Normal file
41
test/markdownlint-test-extra-type.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
// @ts-check
|
||||
|
||||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const globby = require("globby");
|
||||
const test = require("ava").default;
|
||||
const markdownlint = require("../lib/markdownlint");
|
||||
|
||||
// Simulates typing each test file to validate handling of partial input
|
||||
const files = fs.readdirSync("./test");
|
||||
files.filter((file) => /\.md$/.test(file)).forEach((file) => {
|
||||
const strings = {};
|
||||
let content = fs.readFileSync(path.join("./test", file), "utf8");
|
||||
while (content) {
|
||||
strings[content.length.toString()] = content;
|
||||
content = content.slice(0, -1);
|
||||
}
|
||||
test(`type ${file}`, (t) => {
|
||||
t.plan(1);
|
||||
markdownlint.sync({
|
||||
// @ts-ignore
|
||||
strings,
|
||||
"resultVersion": 0
|
||||
});
|
||||
t.pass();
|
||||
});
|
||||
});
|
||||
|
||||
// Parses all Markdown files in all package dependencies
|
||||
test.cb("parseAllFiles", (t) => {
|
||||
t.plan(1);
|
||||
const options = {
|
||||
"files": globby.sync("**/*.{md,markdown}")
|
||||
};
|
||||
markdownlint(options, (err) => {
|
||||
t.falsy(err);
|
||||
t.end();
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue