Something went wrong. Try again.
A local-first note taking app
Something went wrong. Try again.
TypeScript
12345678910111213141516171819202122232425262728293031323334import { describe, expect, it } from 'vitest';
import { resolveDocumentLink } from './resolveDocumentLink';
describe('resolveDocumentLink', () => { const source = { providerId: 'vault-1', path: '/vault/notes/a.md' };
it('resolves a sibling file relative to the source document folder', () => { expect(resolveDocumentLink(source, 'b.md')).toEqual({ providerId: 'vault-1', entryId: '/vault/notes/b.md', title: 'b.md', }); });
it('resolves a nested subfolder target', () => { expect(resolveDocumentLink(source, 'sub/c.md')).toEqual({ providerId: 'vault-1', entryId: '/vault/notes/sub/c.md', title: 'c.md', }); });
it('carries the source provider onto the request', () => { expect( resolveDocumentLink({ providerId: 'other', path: '/x/y.md' }, 'z.md'), ).toEqual({ providerId: 'other', entryId: '/x/z.md', title: 'z.md', }); });});