import { getAvatarImgUrl } from '../get-avatar-img-url'; describe('getAvatarUrl', () => { it('should return personalPhotoUrl if it exists', () => { const props = { workNo: '123456', personalPhotoUrl: 'https://example.com/avatar.jpg', defaultAvatarImgUrl: 'https://example.com/default.jpg', }; const result = getAvatarImgUrl(props); expect(result).toBe('https://example.com/avatar.jpg'); }); it('should return defaultAvatarImgUrl if personalPhotoUrl does not exist', () => { const props = { workNo: '123456', defaultAvatarImgUrl: 'https://example.com/default.jpg', }; const result = getAvatarImgUrl(props); expect(result).toBe('https://example.com/default.jpg'); }); it('should return the default avatar url based on workNo if both personalPhotoUrl and defaultAvatarImgUrl do not exist', () => { const props = { workNo: '123456', }; const result = getAvatarImgUrl(props); expect(result).toBe('https://work.alibaba-inc.com/photo/123456.50x50.jpg'); }); it('should return the default avatar url based on workNo if both personalPhotoUrl and defaultAvatarImgUrl are empty string', () => { const props = { workNo: '987654', personalPhotoUrl: '', defaultAvatarImgUrl: '', }; const result = getAvatarImgUrl(props); expect(result).toBe('https://work.alibaba-inc.com/photo/987654.50x50.jpg'); }); it('should return the default avatar url with different workNo', () => { const props = { workNo: '000001', }; const result = getAvatarImgUrl(props); expect(result).toBe('https://work.alibaba-inc.com/photo/000001.50x50.jpg'); }); });