@aller/blink
Version:
A library for tracking user behaviour.
23 lines (19 loc) • 646 B
text/typescript
import getHostnameFromUrl from '../get-hostname-from-url';
describe('getHostnameFromUrl', () => {
it('should get hostname from normal db url', () => {
expect(
getHostnameFromUrl('https://www.dagbladet.no/a/8912312', 'test.no'),
).toBe('dagbladet.no');
});
it('should use hostname fallback', () => {
expect(getHostnameFromUrl('', 'dagbladet.no')).toBe('dagbladet.no');
});
it('should get hostname from normal db url without query-parameters', () => {
expect(
getHostnameFromUrl(
'https://www.dagbladet.no/a/8912312?query-param=12',
'test.no',
),
).toBe('dagbladet.no');
});
});