refactor: simplify note mutation flushing

This commit is contained in:
lucaronin
2026-04-28 06:25:39 +02:00
parent b85d54bb5d
commit 2a224f78f8
4 changed files with 18 additions and 38 deletions

View File

@@ -70,16 +70,16 @@ describe('useNoteActions frontmatter persistence', () => {
},
},
])('flushes pending raw content before a frontmatter $label', async ({ run }) => {
const flushBeforeFrontmatterChange = vi.fn().mockResolvedValue(undefined)
const flushBeforeNoteMutation = vi.fn().mockResolvedValue(undefined)
const { result } = renderHook(() => useNoteActions({
...makeConfig(vi.fn()),
flushBeforeFrontmatterChange,
flushBeforeNoteMutation,
}))
await act(async () => {
await run(result)
})
expect(flushBeforeFrontmatterChange).toHaveBeenCalledWith('/vault/note.md')
expect(flushBeforeNoteMutation).toHaveBeenCalledWith('/vault/note.md')
})
})