fix: importer bugs and editor bugs

This commit is contained in:
2026-02-14 21:24:01 +01:00
parent b036cf3c46
commit 4b31d9d421
9 changed files with 281 additions and 24 deletions

View File

@@ -76,6 +76,7 @@ const mockMediaEngine = {
reindexText: vi.fn(),
getThumbnailDataUrl: vi.fn(),
regenerateMissingThumbnails: vi.fn(),
getRelativePath: vi.fn(),
};
const mockProjectEngine = {
@@ -606,10 +607,21 @@ describe('IPC Handlers', () => {
});
describe('media:getUrl', () => {
it('should return bds-media protocol URL', async () => {
it('should return relative media path', async () => {
mockMediaEngine.getRelativePath.mockResolvedValue('media/2025/01/media-123.jpg');
const result = await invokeHandler('media:getUrl', 'media-123');
expect(result).toBe('bds-media://media-123');
expect(mockMediaEngine.getRelativePath).toHaveBeenCalledWith('media-123');
expect(result).toBe('media/2025/01/media-123.jpg');
});
it('should fall back to media/{id} when relative path is not found', async () => {
mockMediaEngine.getRelativePath.mockResolvedValue(null);
const result = await invokeHandler('media:getUrl', 'media-unknown');
expect(result).toBe('media/media-unknown');
});
});