feat(v4): Update the help center portal design (#10296)

Co-authored-by: Pranav <pranavrajs@gmail.com>
This commit is contained in:
Sivin Varghese
2024-10-24 10:39:36 +05:30
committed by GitHub
parent 6d3ecfe3c1
commit a3855a8d1d
144 changed files with 6376 additions and 6604 deletions

View File

@@ -6,6 +6,7 @@ import {
getArticleSearchURL,
hasValidAvatarUrl,
timeStampAppendedURL,
getHostNameFromURL,
} from '../URLHelper';
describe('#URL Helpers', () => {
@@ -238,4 +239,28 @@ describe('#URL Helpers', () => {
expect(() => timeStampAppendedURL(input)).toThrow();
});
});
describe('getHostNameFromURL', () => {
it('should return the hostname from a valid URL', () => {
expect(getHostNameFromURL('https://example.com/path')).toBe(
'example.com'
);
});
it('should return null for an invalid URL', () => {
expect(getHostNameFromURL('not a valid url')).toBe(null);
});
it('should return null for an empty string', () => {
expect(getHostNameFromURL('')).toBe(null);
});
it('should return null for undefined input', () => {
expect(getHostNameFromURL(undefined)).toBe(null);
});
it('should correctly handle URLs with non-standard TLDs', () => {
expect(getHostNameFromURL('https://chatwoot.help')).toBe('chatwoot.help');
});
});
});