import linkReplacement from './linkReplacement'; describe('linkReplacement', () => { test('should handle non-resource links', () => { const r = linkReplacement('https://example.com/test').html; expect(r).toBe(''); }); test('should handle non-resource links - simple rendering', () => { const r = linkReplacement('https://example.com/test', { linkRenderingType: 2 }).html; expect(r).toBe(''); }); test('should handle resource links - downloaded status', () => { const resourceId = 'f6afba55bdf74568ac94f8d1e3578d2c'; const r = linkReplacement(`:/${resourceId}`, { ResourceModel: {}, resources: { [resourceId]: { item: {}, localState: { fetch_status: 2, // FETCH_STATUS_DONE }, }, }, }).html; expect(r).toBe(``); }); test('should handle resource links - idle status', () => { const resourceId = 'f6afba55bdf74568ac94f8d1e3578d2c'; const r = linkReplacement(`:/${resourceId}`, { ResourceModel: {}, resources: { [resourceId]: { item: {}, localState: { fetch_status: 0, // FETCH_STATUS_IDLE }, }, }, }).html; // Since the icon is embedded as SVG, we only check for the prefix const expectedPrefix = `