chore: baseline plantilla-proyectos como base del CRM
This commit is contained in:
24
frontend/src/lib/utils.avatar.test.ts
Normal file
24
frontend/src/lib/utils.avatar.test.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { resolveUserAvatarUrl } from './utils';
|
||||
|
||||
describe('resolveUserAvatarUrl', () => {
|
||||
it('prioriza avatar de Workspace cuando es URL absoluta', () => {
|
||||
const value = resolveUserAvatarUrl('https://hub.example.com/media/avatar.png', '/uploads/legacy.png');
|
||||
expect(value).toBe('https://hub.example.com/media/avatar.png');
|
||||
});
|
||||
|
||||
it('acepta avatar de Workspace relativo cuando no hay VITE_HUB_URL', () => {
|
||||
const value = resolveUserAvatarUrl('/media/avatar.png', '/uploads/legacy.png');
|
||||
expect(value).toBe('/media/avatar.png');
|
||||
});
|
||||
|
||||
it('usa avatar legado cuando Workspace no existe', () => {
|
||||
const value = resolveUserAvatarUrl(null, '/uploads/legacy.png');
|
||||
expect(value).toBe('http://localhost:8000/uploads/legacy.png');
|
||||
});
|
||||
|
||||
it('retorna vacio para fallback visual cuando no hay ninguna imagen', () => {
|
||||
const value = resolveUserAvatarUrl(null, null);
|
||||
expect(value).toBe('');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user