mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
make GitCommitTool accept git instance
This commit is contained in:
5 files changed
+12
-16
No files matched your search
@@ -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([
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user