feat: phase 6 of git implementation

This commit is contained in:
2026-02-16 15:34:48 +01:00
parent 339e513a2d
commit e9743cb70f
8 changed files with 249 additions and 2 deletions

View File

@@ -147,6 +147,7 @@ const mockGitEngine = {
getDiff: vi.fn(),
getDiffContent: vi.fn(),
getHistory: vi.fn(),
getRemoteState: vi.fn(),
fetch: vi.fn(),
pull: vi.fn(),
push: vi.fn(),
@@ -361,6 +362,29 @@ describe('IPC Handlers', () => {
});
});
describe('git:remoteState', () => {
it('should pass project path to GitEngine.getRemoteState', async () => {
mockGitEngine.getRemoteState.mockResolvedValue({
localBranch: 'main',
upstreamBranch: 'origin/main',
hasUpstream: true,
ahead: 2,
behind: 1,
});
const result = await invokeHandler('git:remoteState', '/repo');
expect(mockGitEngine.getRemoteState).toHaveBeenCalledWith('/repo');
expect(result).toEqual({
localBranch: 'main',
upstreamBranch: 'origin/main',
hasUpstream: true,
ahead: 2,
behind: 1,
});
});
});
describe('git:diffContent', () => {
it('should pass project path and file path to GitEngine.getDiffContent', async () => {
mockGitEngine.getDiffContent.mockResolvedValue({