Formatting

This commit is contained in:
2026-06-01 12:36:55 +02:00
parent b30243f674
commit c7e1d69e2d
37 changed files with 2187 additions and 1925 deletions

View File

@@ -55,7 +55,7 @@ describe("shell completions", () => {
test("uses shell-native mnemonic completion in fish", () => {
const completions = generateFishCompletions("xo-cli");
expect(completions).toContain("set -l config_dir \"$XO_CONFIG_DIR\"");
expect(completions).toContain('set -l config_dir "$XO_CONFIG_DIR"');
expect(completions).toContain("(__xo_cli_complete_mnemonics)");
expect(completions).not.toContain("(__xo_cli_complete_dynamic mnemonics)");
});
@@ -68,9 +68,9 @@ describe("shell completions", () => {
const contents = readFileSync(configFile, "utf8");
expect(contents.match(/XO_CONFIG_DIR/g)).toHaveLength(2);
expect(contents.match(/eval "\$\(xo-cli completions bash\)"/g)).toHaveLength(
1,
);
expect(
contents.match(/eval "\$\(xo-cli completions bash\)"/g),
).toHaveLength(1);
});
test("adds a missing default without duplicating an existing loader", () => {
@@ -79,16 +79,18 @@ describe("shell completions", () => {
expect(installCompletions("bash", "xo-cli", configFile)).toBe(true);
const contents = readFileSync(configFile, "utf8");
expect(contents.match(/eval "\$\(xo-cli completions bash\)"/g)).toHaveLength(
1,
);
expect(
contents.match(/eval "\$\(xo-cli completions bash\)"/g),
).toHaveLength(1);
expect(contents).toContain(
'export XO_CONFIG_DIR="${XO_CONFIG_DIR:-$HOME/.config/xo-cli}"',
);
});
test("preserves an existing custom config directory assignment", () => {
const configFile = createConfigFile("export XO_CONFIG_DIR=/tmp/custom-xo\n");
const configFile = createConfigFile(
"export XO_CONFIG_DIR=/tmp/custom-xo\n",
);
expect(installCompletions("zsh", "xo-cli", configFile)).toBe(true);