You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
1.2 KiB
25 lines
1.2 KiB
6 years ago
|
import { normalizeUrl } from '../../src/utils/url';
|
||
|
|
||
|
describe('Normalize URL', function() {
|
||
|
const cases = [
|
||
|
{ value: 'localhost:8000', expected: 'http://localhost:8000' },
|
||
|
{ value: 'localhost:8000/', expected: 'http://localhost:8000' },
|
||
|
{ value: 'http://localhost:3000', expected: 'http://localhost:3000' },
|
||
|
{ value: 'http://localhost:3000/', expected: 'http://localhost:3000' },
|
||
|
{ value: 'https://localhost:8000', expected: 'https://localhost:8000' },
|
||
|
{ value: 'https://localhost:8000/', expected: 'https://localhost:8000' },
|
||
|
{ value: 'http://example.com', expected: 'http://example.com' },
|
||
|
{ value: 'http://example.com/', expected: 'http://example.com' },
|
||
|
{ value: 'https://example.com', expected: 'https://example.com' },
|
||
|
{ value: 'https://example.com/', expected: 'https://example.com' },
|
||
|
{ value: 'https://example.com/grafana', expected: 'https://example.com/grafana' },
|
||
|
{ value: 'https://example.com/grafana/', expected: 'https://example.com/grafana' },
|
||
|
];
|
||
|
|
||
|
it('should normalize URLs correctly', function() {
|
||
|
cases.forEach(testCase => {
|
||
|
expect(normalizeUrl(testCase.value)).toBe(testCase.expected);
|
||
|
});
|
||
|
});
|
||
|
});
|