0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-20 22:52:46 -05:00
verdaccio/packages/core/url/tests/validHost.spec.ts
Juan Picado 0c7b19b192
chore: migrate vitest packages (#4777)
* chore: migrate core to vitest

* chore: migrate url module

* chore: migrate tarball package

* chore: migrate loader package

* chore: migrate hook package

* chore: migrate signature package

* chore: migrate utils package
2024-08-03 19:39:22 +02:00

20 lines
667 B
TypeScript

import { expect, test } from 'vitest';
import { isHost } from '../src';
test('valid host', () => {
expect(isHost('http://ddd.dd.og')).toBeTruthy();
expect(isHost('https://ddd.dd.og')).toBeTruthy();
expect(isHost('https://ddd.dd.og/valid')).toBeTruthy();
expect(isHost('ddd.dd.og')).toBeTruthy();
expect(isHost('ddd.dd.og:40')).toBeTruthy();
expect(isHost('ddd.dd.og/someprefix')).toBeTruthy();
});
test('invalid', () => {
expect(isHost('/ddd.dd.og:40')).toBeFalsy();
expect(isHost('/')).toBeFalsy();
expect(isHost('')).toBeFalsy();
expect(isHost(undefined)).toBeFalsy();
expect(isHost(`/ddd.dd.og>"<svg onload="alert(1)">`)).toBeFalsy();
});