99f53a5030
Fixes #8601 We had 3 implementations of getImageAbsoluteURI: in twenty-front, in twenty-ui and in twenty-emails. I was able to remove the one in twenty-front but I could not remove it from twenty-emails as this is a standalone for now. The vision is to introduce shared utils in a twenty-shared package
22 lines
748 B
TypeScript
22 lines
748 B
TypeScript
import { getImageAbsoluteURI } from '../getImageAbsoluteURI';
|
|
|
|
describe('getImageAbsoluteURI', () => {
|
|
it('should return absolute url if the imageUrl is an absolute url', () => {
|
|
const imageUrl = 'https://XXX';
|
|
const result = getImageAbsoluteURI(imageUrl);
|
|
expect(result).toBe(imageUrl);
|
|
});
|
|
|
|
it('should return absolute url if the imageUrl is an absolute unsecure url', () => {
|
|
const imageUrl = 'http://XXX';
|
|
const result = getImageAbsoluteURI(imageUrl);
|
|
expect(result).toBe(imageUrl);
|
|
});
|
|
|
|
it('should return fully formed url if imageUrl is a relative url', () => {
|
|
const imageUrl = 'XXX';
|
|
const result = getImageAbsoluteURI(imageUrl);
|
|
expect(result).toBe('http://localhost:3000/files/XXX');
|
|
});
|
|
});
|