feat: phase 3 for git integration

This commit is contained in:
hugo committed 2026-02-16 11:46:47 +01:00
1 parent 4c437cbea2
commit 9d71aa63fb
18 files changed
+499 -7

No files matched your search

+18
View File
@@ -144,6 +144,7 @@ const mockGitEngine = {
checkAvailability: vi.fn(),
getRepoState: vi.fn(),
getStatus: vi.fn(),
getDiff: vi.fn(),
initializeRepo: vi.fn(),
ensureGitignore: vi.fn(),
pruneLfsCache: vi.fn(),
@@ -318,6 +319,23 @@ describe('IPC Handlers', () => {
});
});
describe('git:diff', () => {
it('should pass project path and file path to GitEngine.getDiff', async () => {
mockGitEngine.getDiff.mockResolvedValue({
filePath: 'posts/first.md',
patch: 'diff --git a/posts/first.md b/posts/first.md',
});
const result = await invokeHandler('git:diff', '/repo', 'posts/first.md');
expect(mockGitEngine.getDiff).toHaveBeenCalledWith('/repo', 'posts/first.md');
expect(result).toEqual({
filePath: 'posts/first.md',
patch: 'diff --git a/posts/first.md b/posts/first.md',
});
});
});
describe('git:init', () => {
it('should pass project path to GitEngine.initializeRepo', async () => {
mockGitEngine.initializeRepo.mockResolvedValue({ success: true });