fix: harden rename saves and async deletes

This commit is contained in:
lucaronin
2026-04-14 15:40:46 +02:00
parent 9f46f22667
commit 0078cc257a
10 changed files with 224 additions and 35 deletions

View File

@@ -573,8 +573,10 @@ describe('useNoteActions hook', () => {
filename: 'old-name.md',
title: 'Old Name',
})
const onPathRenamed = vi.fn()
const replaceEntry = vi.fn()
const config = makeConfig([entry])
config.onPathRenamed = onPathRenamed
config.replaceEntry = replaceEntry
vi.mocked(mockInvoke).mockImplementation(async (cmd: string) => {
@@ -601,6 +603,7 @@ describe('useNoteActions hook', () => {
'/test/vault/old-name.md',
expect.objectContaining({ path: '/test/vault/new-name.md', title: 'New Name' }),
)
expect(onPathRenamed).toHaveBeenCalledWith('/test/vault/old-name.md', '/test/vault/new-name.md')
})
it('handleUpdateFrontmatter does not trigger rename for non-title keys', async () => {