feat(desktop): 持久化最近 Vault 授权

This commit is contained in:
2026-09-07 17:55:42 +08:00
parent 8ae5006ea7
commit 34a36bb328
8 changed files with 257 additions and 19 deletions
@@ -28,6 +28,13 @@ describe('原生 Workspace 适配', () => {
})
it('取消原生目录选择不进入空 Vault', async () => {
native.enabled = true; native.invoke.mockResolvedValue(null)
await expect(workspace.openVault('ignored')).rejects.toThrow()
await expect(workspace.openVault('')).rejects.toThrow()
expect(native.invoke).toHaveBeenCalledWith('workspace_choose', undefined)
})
it('最近 Vault 只能通过已授权路径命令重开', async () => {
native.enabled = true
native.invoke.mockResolvedValue({ vault_id: 'vault', path: 'C:\\notes', name: 'notes' })
await expect(workspace.openVault('C:\\notes')).resolves.toMatchObject({ vault_id: 'vault' })
expect(native.invoke).toHaveBeenCalledWith('workspace_open', { path: 'C:\\notes' })
})
})