import { describe, expect, it } from 'vitest'; import { collectPluginReadRoots, fileUrlToPath } from './plugin-local-file.rules'; describe('plugin-local-file.rules', () => { it('resolves linux file URLs to absolute paths', () => { expect(fileUrlToPath('file:///home/ludde/Desktop/TestPlugin/plugin-source.json')) .toBe('/home/ludde/Desktop/TestPlugin/plugin-source.json'); }); it('collects plugin read roots from source and entrypoint URLs', () => { expect(collectPluginReadRoots( 'file:///home/ludde/Desktop/TestPlugin/plugin-source.json', 'file:///home/ludde/Desktop/TestPlugin/dist/main.js' )).toEqual(['/home/ludde/Desktop/TestPlugin', '/home/ludde/Desktop/TestPlugin/dist']); }); it('treats directory file URLs as their own read roots', () => { expect(collectPluginReadRoots('file:///home/ludde/Desktop/TestPlugin/')).toEqual(['/home/ludde/Desktop/TestPlugin']); expect(collectPluginReadRoots('file:///home/ludde/Desktop/TestPlugin')).toEqual(['/home/ludde/Desktop/TestPlugin']); }); });