mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-14 16:46:25 +00:00
48 lines
2.1 KiB
TypeScript
48 lines
2.1 KiB
TypeScript
import { resolveBaseUrl } from './url';
|
|
|
|
describe('util/url', () => {
|
|
test.each([
|
|
['http://foo.io', '', 'http://foo.io'],
|
|
['http://foo.io/', '', 'http://foo.io'],
|
|
['http://foo.io', '/', 'http://foo.io/'],
|
|
['http://foo.io/', '/', 'http://foo.io/'],
|
|
|
|
['http://foo.io', '/aaa', 'http://foo.io/aaa'],
|
|
['http://foo.io', 'aaa', 'http://foo.io/aaa'],
|
|
['http://foo.io/', '/aaa', 'http://foo.io/aaa'],
|
|
['http://foo.io/', 'aaa', 'http://foo.io/aaa'],
|
|
['http://foo.io', '/aaa/', 'http://foo.io/aaa/'],
|
|
['http://foo.io', 'aaa/', 'http://foo.io/aaa/'],
|
|
['http://foo.io/', '/aaa/', 'http://foo.io/aaa/'],
|
|
['http://foo.io/', 'aaa/', 'http://foo.io/aaa/'],
|
|
|
|
['http://foo.io/aaa', '/bbb', 'http://foo.io/aaa/bbb'],
|
|
['http://foo.io/aaa', 'bbb', 'http://foo.io/aaa/bbb'],
|
|
['http://foo.io/aaa/', '/bbb', 'http://foo.io/aaa/bbb'],
|
|
['http://foo.io/aaa/', 'bbb', 'http://foo.io/aaa/bbb'],
|
|
|
|
['http://foo.io/aaa', '/bbb/', 'http://foo.io/aaa/bbb/'],
|
|
['http://foo.io/aaa', 'bbb/', 'http://foo.io/aaa/bbb/'],
|
|
['http://foo.io/aaa/', '/bbb/', 'http://foo.io/aaa/bbb/'],
|
|
['http://foo.io/aaa/', 'bbb/', 'http://foo.io/aaa/bbb/'],
|
|
|
|
['http://foo.io', 'http://bar.io/bbb', 'http://bar.io/bbb'],
|
|
['http://foo.io/', 'http://bar.io/bbb', 'http://bar.io/bbb'],
|
|
['http://foo.io/aaa', 'http://bar.io/bbb', 'http://bar.io/bbb'],
|
|
['http://foo.io/aaa/', 'http://bar.io/bbb', 'http://bar.io/bbb'],
|
|
|
|
['http://foo.io', 'http://bar.io/bbb/', 'http://bar.io/bbb/'],
|
|
['http://foo.io/', 'http://bar.io/bbb/', 'http://bar.io/bbb/'],
|
|
['http://foo.io/aaa', 'http://bar.io/bbb/', 'http://bar.io/bbb/'],
|
|
['http://foo.io/aaa/', 'http://bar.io/bbb/', 'http://bar.io/bbb/'],
|
|
|
|
['http://foo.io', 'aaa?bbb=z', 'http://foo.io/aaa?bbb=z'],
|
|
['http://foo.io', '/aaa?bbb=z', 'http://foo.io/aaa?bbb=z'],
|
|
['http://foo.io/', 'aaa?bbb=z', 'http://foo.io/aaa?bbb=z'],
|
|
['http://foo.io/', '/aaa?bbb=z', 'http://foo.io/aaa?bbb=z'],
|
|
|
|
['http://foo.io', 'aaa/?bbb=z', 'http://foo.io/aaa?bbb=z'],
|
|
])('%s + %s => %s', (baseUrl, x, result) => {
|
|
expect(resolveBaseUrl(baseUrl, x)).toBe(result);
|
|
});
|
|
});
|