mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-20 22:52:46 -05:00
0c7b19b192
* 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
20 lines
667 B
TypeScript
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();
|
|
});
|