2021-12-26 15:21:09 +03:00
|
|
|
import { replaceAuthorityFromUri } from '../../../src/utils/helpers/uri';
|
|
|
|
|
|
|
|
describe('uri-helper', () => {
|
|
|
|
describe('replaceAuthorityFromUri', () => {
|
|
|
|
it.each([
|
2022-03-26 14:17:42 +03:00
|
|
|
['http://something.com/foo/bar', 'www.new.to', 'http://www.new.to/foo/bar'],
|
2023-01-18 00:53:49 +03:00
|
|
|
['https://www.authori.ty:8000/', 's.test', 'https://s.test/'],
|
2022-03-26 14:17:42 +03:00
|
|
|
['http://localhost:8080/this/is-a-long/path', 'somewhere:8888', 'http://somewhere:8888/this/is-a-long/path'],
|
2021-12-26 15:21:09 +03:00
|
|
|
])('replaces authority as expected', (uri, newAuthority, expectedResult) => {
|
|
|
|
expect(replaceAuthorityFromUri(uri, newAuthority)).toEqual(expectedResult);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|