mirror of
https://github.com/stablyai/orca.git
synced 2026-10-18 16:03:17 +00:00
27 lines
867 B
TypeScript
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'
|
|
})
|
|
})
|
|
})
|