Migrate to a monorepo structure (#2909)

This commit is contained in:
Charles Bochet
2023-12-10 18:10:54 +01:00
committed by GitHub
parent a70a9281eb
commit 5bdca9de6c
2304 changed files with 37152 additions and 25869 deletions

View File

@ -0,0 +1,49 @@
import { getLogoUrlFromDomainName, sanitizeURL } from '..';
describe('sanitizeURL', () => {
test('should sanitize the URL correctly', () => {
expect(sanitizeURL('http://example.com/')).toBe('example.com');
expect(sanitizeURL('https://www.example.com/')).toBe('example.com');
expect(sanitizeURL('www.example.com')).toBe('example.com');
expect(sanitizeURL('example.com')).toBe('example.com');
expect(sanitizeURL('example.com/')).toBe('example.com');
});
test('should handle undefined input', () => {
expect(sanitizeURL(undefined)).toBe('');
});
});
describe('getLogoUrlFromDomainName', () => {
test('should return the correct logo URL for a given domain', () => {
expect(getLogoUrlFromDomainName('example.com')).toBe(
'https://favicon.twenty.com/example.com',
);
expect(getLogoUrlFromDomainName('http://example.com/')).toBe(
'https://favicon.twenty.com/example.com',
);
expect(getLogoUrlFromDomainName('https://www.example.com/')).toBe(
'https://favicon.twenty.com/example.com',
);
expect(getLogoUrlFromDomainName('www.example.com')).toBe(
'https://favicon.twenty.com/example.com',
);
expect(getLogoUrlFromDomainName('example.com/')).toBe(
'https://favicon.twenty.com/example.com',
);
expect(getLogoUrlFromDomainName('apple.com')).toBe(
'https://favicon.twenty.com/apple.com',
);
});
test('should handle undefined input', () => {
expect(getLogoUrlFromDomainName(undefined)).toBe(
'https://favicon.twenty.com/',
);
});
});