fix: restore manual commit dialog when autogit is off
This commit is contained in:
32
src/utils/commitEntryAction.test.ts
Normal file
32
src/utils/commitEntryAction.test.ts
Normal 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()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user