mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 20:18:08 +00:00
feat(v4): Update the help center portal design (#10296)
Co-authored-by: Pranav <pranavrajs@gmail.com>
This commit is contained in:
@@ -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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user