mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 10:16:44 +00:00
test(scripts): route docs spellcheck config
This commit is contained in:
@@ -1060,6 +1060,9 @@ const TOOLING_SOURCE_TEST_TARGETS = new Map([
|
||||
["scripts/run-with-env.mjs", ["test/scripts/run-with-env.test.ts"]],
|
||||
["scripts/run-node.mjs", ["src/infra/run-node.test.ts"]],
|
||||
["scripts/auth-monitor.sh", ["test/scripts/auth-monitor.test.ts"]],
|
||||
["scripts/codespell-dictionary.txt", ["test/scripts/docs-spellcheck.test.ts"]],
|
||||
["scripts/codespell-ignore.txt", ["test/scripts/docs-spellcheck.test.ts"]],
|
||||
["scripts/docs-spellcheck.sh", ["test/scripts/docs-spellcheck.test.ts"]],
|
||||
["scripts/mobile-reauth.sh", ["test/scripts/auth-monitor.test.ts"]],
|
||||
["scripts/committer", ["test/scripts/committer.test.ts"]],
|
||||
["scripts/gh-read", ["test/scripts/gh-read.test.ts"]],
|
||||
@@ -1565,6 +1568,7 @@ const TOOLING_TEST_TARGETS = new Map([
|
||||
["test/scripts/ci-docker-pull-retry.test.ts", ["test/scripts/ci-docker-pull-retry.test.ts"]],
|
||||
["test/scripts/control-ui-i18n.test.ts", ["test/scripts/control-ui-i18n.test.ts"]],
|
||||
["test/scripts/docker-build-helper.test.ts", ["test/scripts/docker-build-helper.test.ts"]],
|
||||
["test/scripts/docs-spellcheck.test.ts", ["test/scripts/docs-spellcheck.test.ts"]],
|
||||
["test/scripts/docker-e2e-helper-cli.test.ts", ["test/scripts/docker-e2e-helper-cli.test.ts"]],
|
||||
["test/scripts/kova-ci-summary.test.ts", ["test/scripts/kova-ci-summary.test.ts"]],
|
||||
["test/scripts/live-docker-stage.test.ts", ["test/scripts/live-docker-stage.test.ts"]],
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// Docs spellcheck tests cover codespell wrapper configuration.
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const SCRIPT_PATH = "scripts/docs-spellcheck.sh";
|
||||
const DICTIONARY_PATH = "scripts/codespell-dictionary.txt";
|
||||
const IGNORE_PATH = "scripts/codespell-ignore.txt";
|
||||
|
||||
function nonEmptyLines(path: string): string[] {
|
||||
return readFileSync(path, "utf8").split("\n").filter(Boolean);
|
||||
}
|
||||
|
||||
describe("scripts/docs-spellcheck.sh", () => {
|
||||
it("uses the repository dictionary and ignore files", () => {
|
||||
const script = readFileSync(SCRIPT_PATH, "utf8");
|
||||
|
||||
expect(script).toContain("-D");
|
||||
expect(script).toContain("-");
|
||||
expect(script).toContain("-D\n scripts/codespell-dictionary.txt");
|
||||
expect(script).toContain("-I\n scripts/codespell-ignore.txt");
|
||||
});
|
||||
|
||||
it("keeps codespell config entries non-empty and unique", () => {
|
||||
for (const path of [DICTIONARY_PATH, IGNORE_PATH]) {
|
||||
const lines = nonEmptyLines(path);
|
||||
|
||||
expect(lines.length).toBeGreaterThan(0);
|
||||
expect(new Set(lines).size).toBe(lines.length);
|
||||
for (const line of lines) {
|
||||
expect(line).toBe(line.trim());
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1395,6 +1395,22 @@ describe("scripts/test-projects changed-target routing", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps docs spellcheck config edits on owner tests", () => {
|
||||
const expectedTargets = new Map([
|
||||
["scripts/codespell-dictionary.txt", ["test/scripts/docs-spellcheck.test.ts"]],
|
||||
["scripts/codespell-ignore.txt", ["test/scripts/docs-spellcheck.test.ts"]],
|
||||
["scripts/docs-spellcheck.sh", ["test/scripts/docs-spellcheck.test.ts"]],
|
||||
["test/scripts/docs-spellcheck.test.ts", ["test/scripts/docs-spellcheck.test.ts"]],
|
||||
]);
|
||||
|
||||
for (const [source, targets] of expectedTargets) {
|
||||
expect(resolveChangedTestTargetPlan([source]), source).toEqual({
|
||||
mode: "targets",
|
||||
targets,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps shared script library edits on owner tests", () => {
|
||||
const expectedTargets = new Map([
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user