Files
orca/src/main/ipc/markdown-documents.test.ts
T
2026-05-20 17:20:16 -07:00

27 lines
867 B
TypeScript

import { describe, expect, it } from 'vitest'
import { markdownDocumentFromFilePath } from './markdown-documents'
describe('markdownDocumentFromFilePath', () => {
it('keeps in-root path segments that merely start with parent traversal text', () => {
expect(markdownDocumentFromFilePath('/workspace', '/workspace/..notes/file.md')).toMatchObject({
filePath: '/workspace/..notes/file.md',
relativePath: '..notes/file.md',
basename: 'file.md',
name: 'file'
})
})
it('treats actual parent traversal as outside the root', () => {
expect(
markdownDocumentFromFilePath('/workspace', '/workspace-other/file.md', {
outsideRootRelativePath: 'basename'
})
).toMatchObject({
filePath: '/workspace-other/file.md',
relativePath: 'file.md',
basename: 'file.md',
name: 'file'
})
})
})