Merge branch 'main' into main
This commit is contained in:
@@ -104,7 +104,7 @@ describe('main entrypoint', () => {
|
||||
rootOptions().onCaughtError?.(error, { componentStack: '\n in App' })
|
||||
|
||||
expect(mocks.sentryHandler).toHaveBeenCalledWith(error, { componentStack: '\n in App' })
|
||||
}, 20_000)
|
||||
}, 60_000)
|
||||
|
||||
it('normalizes missing React component stacks before handing errors to Sentry', async () => {
|
||||
await importEntrypoint()
|
||||
|
||||
@@ -68,11 +68,24 @@ describe('filterEntries', () => {
|
||||
makeEntry({ path: '/vault/note/real-note.md', title: 'Real Note', isA: 'Note' }),
|
||||
makeEntry({ path: '/vault/attachments/reference.md', title: 'Attachment Markdown', isA: 'Note' }),
|
||||
makeEntry({ path: '/vault/attachments/nested/diagram.md', title: 'Nested Attachment Markdown', isA: 'Note' }),
|
||||
makeEntry({ path: 'C:\\Users\\luca\\Vault\\attachments\\windows.md', title: 'Windows Attachment Markdown', isA: 'Note' }),
|
||||
]
|
||||
|
||||
const result = filterEntries(entries, allSelection, 'open')
|
||||
expect(result.map((entry) => entry.title)).toEqual(['Real Note'])
|
||||
})
|
||||
|
||||
it('matches slash-based folder selections against Windows entry paths', () => {
|
||||
const entries = [
|
||||
makeEntry({ path: 'C:\\Users\\luca\\Vault\\Client Work\\Alpha.md', title: 'Alpha' }),
|
||||
makeEntry({ path: 'C:\\Users\\luca\\Vault\\Client Work\\Nested\\Beta.md', title: 'Beta' }),
|
||||
makeEntry({ path: 'C:\\Users\\luca\\Vault\\Client Work Archive\\Old.md', title: 'Archive' }),
|
||||
makeEntry({ path: 'C:\\Users\\luca\\Vault\\客户\\计划.md', title: 'Unicode' }),
|
||||
]
|
||||
|
||||
expect(filterEntries(entries, { kind: 'folder', path: 'Client Work' }).map((entry) => entry.title)).toEqual(['Alpha', 'Beta'])
|
||||
expect(filterEntries(entries, { kind: 'folder', path: '客户' }).map((entry) => entry.title)).toEqual(['Unicode'])
|
||||
})
|
||||
})
|
||||
|
||||
describe('countByFilter', () => {
|
||||
|
||||
@@ -397,8 +397,14 @@ function applySubFilter(entries: VaultEntry[], subFilter: NoteListFilter): Vault
|
||||
}
|
||||
|
||||
function isInFolder(entryPath: string, folderRelPath: string): boolean {
|
||||
const needle = '/' + folderRelPath + '/'
|
||||
return entryPath.includes(needle) || entryPath.startsWith(folderRelPath + '/')
|
||||
const folderPath = normalizeFolderPath(folderRelPath)
|
||||
if (!folderPath) return false
|
||||
const normalizedEntryPath = normalizeFolderPath(entryPath)
|
||||
return normalizedEntryPath.includes(`/${folderPath}/`) || normalizedEntryPath.startsWith(`${folderPath}/`)
|
||||
}
|
||||
|
||||
function normalizeFolderPath(path: string): string {
|
||||
return path.replace(/\\/g, '/').replace(/^\/+|\/+$/g, '')
|
||||
}
|
||||
|
||||
export function isAllNotesEntry(entry: VaultEntry): boolean {
|
||||
|
||||
Reference in New Issue
Block a user