Skip to content

Commit f7f87b5

Browse files
AlbinoGeekclaude
andcommitted
test(presets): use shared gitCmd helper instead of duplicate definition
Remove duplicate gitCmd function definition and import shared version from test-harness. The local definition was identical to the shared helper, just manually setting up the same environment variables. Eliminates 15 lines of duplication. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent e59ce19 commit f7f87b5

1 file changed

Lines changed: 7 additions & 19 deletions

File tree

src/server/list-presets-tool.test.ts

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,18 @@
11
import { afterEach, describe, expect, test } from "bun:test";
2-
import { type ExecSyncOptionsWithStringEncoding, execFileSync } from "node:child_process";
32
import { mkdirSync, writeFileSync } from "node:fs";
43
import { join } from "node:path";
54

65
import { registerListPresetsTool } from "./list-presets-tool.js";
7-
import { captureTool, cleanupTmpPaths, mkTmpDir, writeTestGitConfig } from "./test-harness.js";
6+
import {
7+
captureTool,
8+
cleanupTmpPaths,
9+
gitCmd,
10+
mkTmpDir,
11+
writeTestGitConfig,
12+
} from "./test-harness.js";
813

914
afterEach(cleanupTmpPaths);
1015

11-
function gitCmd(cwd: string, ...args: string[]): string {
12-
const opts: ExecSyncOptionsWithStringEncoding = {
13-
cwd,
14-
encoding: "utf8",
15-
env: {
16-
...process.env,
17-
GIT_AUTHOR_NAME: "Test User",
18-
GIT_AUTHOR_EMAIL: "test@example.com",
19-
GIT_COMMITTER_NAME: "Test User",
20-
GIT_COMMITTER_EMAIL: "test@example.com",
21-
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z",
22-
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z",
23-
},
24-
};
25-
return execFileSync("git", args, opts);
26-
}
27-
2816
function makeRepoWithPresets(): string {
2917
const dir = mkTmpDir("mcp-git-list-presets-test-");
3018
gitCmd(dir, "init", "-b", "main");

0 commit comments

Comments
 (0)