piral-cli
Version:
The standard CLI for creating and building a Piral instance or a Pilet.
30 lines (24 loc) • 904 B
text/typescript
import { describe, it, expect } from 'vitest';
import { normalizePublicUrl } from './url';
describe('Url Module', () => {
it('normalizePublicUrl always returns at least /', () => {
const result = normalizePublicUrl('');
expect(result).toBe('/');
});
it('normalizePublicUrl makes URLs end with /', async () => {
const result = normalizePublicUrl('/foo');
expect(result).toBe('/foo/');
});
it('normalizePublicUrl makes URLs start with /', async () => {
const result = normalizePublicUrl('foo/');
expect(result).toBe('/foo/');
});
it('normalizePublicUrl makes URLs start and end with /', async () => {
const result = normalizePublicUrl('foo');
expect(result).toBe('/foo/');
});
it('normalizePublicUrl leaves good URLs as-is', async () => {
const result = normalizePublicUrl('/foo/bar/1.2.3/');
expect(result).toBe('/foo/bar/1.2.3/');
});
});