fix: restore manual commit dialog when autogit is off

This commit is contained in:
lucaronin
2026-04-18 09:58:49 +02:00
parent 6a90e9f770
commit 54b2616fa4
4 changed files with 232 additions and 5 deletions

View File

@@ -0,0 +1,32 @@
import { describe, expect, it, vi } from 'vitest'
import { triggerCommitEntryAction } from './commitEntryAction'
describe('triggerCommitEntryAction', () => {
it('runs the automatic checkpoint when AutoGit is enabled', () => {
const openCommitDialog = vi.fn().mockResolvedValue(undefined)
const runAutomaticCheckpoint = vi.fn().mockResolvedValue(true)
triggerCommitEntryAction({
autoGitEnabled: true,
openCommitDialog,
runAutomaticCheckpoint,
})
expect(runAutomaticCheckpoint).toHaveBeenCalledWith({ savePendingBeforeCommit: true })
expect(openCommitDialog).not.toHaveBeenCalled()
})
it('opens the manual commit dialog when AutoGit is disabled', () => {
const openCommitDialog = vi.fn().mockResolvedValue(undefined)
const runAutomaticCheckpoint = vi.fn().mockResolvedValue(true)
triggerCommitEntryAction({
autoGitEnabled: false,
openCommitDialog,
runAutomaticCheckpoint,
})
expect(openCommitDialog).toHaveBeenCalledTimes(1)
expect(runAutomaticCheckpoint).not.toHaveBeenCalled()
})
})