fix: importer bugs and editor bugs

This commit is contained in:
hugo committed 2026-02-14 21:24:01 +01:00
1 parent b036cf3c46
commit 4b31d9d421
9 files changed
+281 -24

No files matched your search

+14 -2
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');
});
});