wip
Some checks are pending
Checkers / linkcheck (push) Waiting to run
Checkers / spellcheck (push) Waiting to run
CI / build (20, macos-latest) (push) Waiting to run
CI / build (20, ubuntu-latest) (push) Waiting to run
CI / build (20, windows-latest) (push) Waiting to run
CI / build (22, macos-latest) (push) Waiting to run
CI / build (22, ubuntu-latest) (push) Waiting to run
CI / build (22, windows-latest) (push) Waiting to run
CI / build (24, macos-latest) (push) Waiting to run
CI / build (24, ubuntu-latest) (push) Waiting to run
CI / build (24, windows-latest) (push) Waiting to run
CI / pnpm (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
TestRepos / build (latest, ubuntu-latest) (push) Waiting to run
UpdateTestRepos / update (push) Waiting to run

This commit is contained in:
David Anson 2025-08-26 23:03:50 -07:00
parent a56441003e
commit 7e364c6a8f
3 changed files with 97 additions and 25 deletions

View file

@ -2,7 +2,9 @@
import test from "ava";
import { lint as lintAsync } from "markdownlint/async";
import { lint as lintPromise } from "markdownlint/promise";
import { lint as lintSync } from "markdownlint/sync";
import { convertToResultVersion0, convertToResultVersion1, convertToResultVersion2 } from "markdownlint/helpers";
import { importWithTypeJson } from "./esm-helpers.mjs";
const packageJson = await importWithTypeJson(import.meta, "../package.json");
const { homepage, version } = packageJson;
@ -623,3 +625,35 @@ test("frontMatterResultVersion3", (t) => new Promise((resolve) => {
resolve();
});
}));
test("convertToResultVersionN", async (t) => {
t.plan(6);
const options = {
"files": [
"./test/break-all-the-rules.md",
"./test/inline-disable-enable.md"
],
"strings": {
"apple": "# Heading",
"banana": "## Heading"
}
};
const [ version3, version2, version1, version0 ] = await Promise.all([
lintPromise(options),
lintPromise({ ...options, "resultVersion": 2 }),
lintPromise({ ...options, "resultVersion": 1 }),
lintPromise({ ...options, "resultVersion": 0 })
]);
const v2 = convertToResultVersion2(version3);
t.deepEqual(v2, version2);
t.is(v2.toString(), version2.toString());
const v1 = convertToResultVersion1(version3);
t.deepEqual(v1, version1);
t.is(v1.toString(), version1.toString());
const v0 = convertToResultVersion0(version3);
t.deepEqual(v0, version0);
t.is(v0.toString(), version0.toString());
});