make GitCommitTool accept git instance

This commit is contained in:
Alex Gleason committed 2025-09-14 17:27:12 -05:00
1 parent 1ab895bd59
commit bc009d444e
5 files changed
+12 -16

No files matched your search

+4 -1
View File
@@ -1,5 +1,6 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { GitCommitTool } from './GitCommitTool';
import { Git } from '../git';
import type { JSRuntimeFS } from '../JSRuntime';
// Mock the Git class
@@ -33,10 +34,12 @@ const mockFS: JSRuntimeFS = {
describe('GitCommitTool', () => {
let tool: GitCommitTool;
let mockGit: Git;
beforeEach(() => {
vi.clearAllMocks();
tool = new GitCommitTool(mockFS, '/test/project');
mockGit = mockGitInstance as unknown as Git;
tool = new GitCommitTool(mockFS, '/test/project', mockGit);
// Setup default mocks
mockGitInstance.statusMatrix.mockResolvedValue([
+2 -2
View File
@@ -19,9 +19,9 @@ export class GitCommitTool implements Tool<GitCommitParams> {
message: z.string().describe('Commit message text'),
});
constructor(fs: JSRuntimeFS, cwd: string) {
constructor(fs: JSRuntimeFS, cwd: string, git: Git) {
this.fs = fs;
this.git = new Git(fs);
this.git = git;
this.cwd = cwd;
}