Files
Netcatty/components/terminal/figSpecLoader.test.ts
T
csr588 4db44e2ede test(autocomplete): cover all preloaded specs and Apple extension term
- Assert every one of the 22 batch-4 commands in COMMON_FIG_SPECS; the old
  loop only covered 7, so dropping a preload entry could pass unnoticed.
- Keep the noun “extension” as 擴充功能: the generic 擴充套件→擴充 rule is
  right for “extended” compounds (擴充屬性, 擴充標頭, 擴充正規表示式), but
  Apple's option descriptions need the noun form.
2026-11-08 13:19:41 +08:00

26 lines
1.1 KiB
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import { COMMON_FIG_SPECS, normalizeCommandName } from "./autocomplete/figSpecLoader";
test("preload common specs includes dnf alongside yum and apt", () => {
assert.ok(COMMON_FIG_SPECS.includes("apt"));
assert.ok(COMMON_FIG_SPECS.includes("yum"));
assert.ok(COMMON_FIG_SPECS.includes("dnf"));
for (const command of ["ln", "stat", "wc", "cut", "uniq", "tee", "xargs"]) {
assert.ok(COMMON_FIG_SPECS.includes(command), `${command} should be preloaded`);
}
const batch4Commands = [
"echo", "which", "paste", "pwd", "clear", "su", "crontab", "env", "uname",
"base64", "date", "id", "split", "seq", "join", "dig", "dd", "htop",
"basename", "dirname", "readlink", "more",
];
for (const command of batch4Commands) {
assert.ok(COMMON_FIG_SPECS.includes(command), `${command} should be preloaded`);
}
});
test("normalizeCommandName strips path and extension", () => {
assert.equal(normalizeCommandName("/usr/bin/dnf"), "dnf");
assert.equal(normalizeCommandName("DNF"), "dnf");
});