feat: support mounted vault workspaces

This commit is contained in:
lucaronin
2026-05-11 16:37:06 +02:00
parent 5c05347690
commit 07edfac400
176 changed files with 8868 additions and 1535 deletions

View File

@@ -1,5 +1,6 @@
import { describe, it, expect, vi } from 'vitest'
import { resolveHeaderTitle, routeNoteClick, type ClickActions } from './noteListUtils'
import { createNoteStatusResolver, resolveHeaderTitle, routeNoteClick, type ClickActions } from './noteListUtils'
import type { ModifiedFile } from '../../types'
import type { SidebarSelection, VaultEntry } from '../../types'
function makeEntry(path = '/test.md'): VaultEntry {
@@ -103,3 +104,36 @@ describe('routeNoteClick', () => {
expect(actions.onEnterNeighborhood).not.toHaveBeenCalled()
})
})
describe('createNoteStatusResolver', () => {
it('keeps transient note status ahead of repository status', () => {
const modifiedFiles: ModifiedFile[] = [{
path: '/vault/note.md',
relativePath: 'note.md',
status: 'modified',
}]
const resolver = createNoteStatusResolver(
() => 'unsaved',
modifiedFiles,
new Set(modifiedFiles.map((file) => file.path)),
)
expect(resolver('/vault/note.md')).toBe('unsaved')
})
it('uses modified files when active-vault status says the note is clean', () => {
const modifiedFiles: ModifiedFile[] = [{
path: '/other-vault/note.md',
relativePath: 'note.md',
status: 'untracked',
vaultPath: '/other-vault',
}]
const resolver = createNoteStatusResolver(
() => 'clean',
modifiedFiles,
new Set(modifiedFiles.map((file) => file.path)),
)
expect(resolver('/other-vault/note.md')).toBe('new')
})
})