We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9317f66 commit b86c7f9Copy full SHA for b86c7f9
1 file changed
‎src/__tests__/utils.test.ts‎
@@ -45,4 +45,29 @@ describe('joinUrls', () => {
45
'https://cdn.example.com/base/file.txt',
46
]);
47
});
48
+
49
+ test('handles empty string paths', () => {
50
+ expect(joinUrls([''], 'file.txt')).toEqual(['https:///file.txt']);
51
+ });
52
53
+ test('trims multiple trailing slashes', () => {
54
+ expect(joinUrls(['example.com///', 'http://example.com///'], 'file.txt')).toEqual([
55
+ 'https://example.com/file.txt',
56
+ 'http://example.com/file.txt',
57
+ ]);
58
59
60
+ test('preserves custom protocols', () => {
61
+ expect(joinUrls(['ftp://example.com', 'myapp://some/path'], 'file.txt')).toEqual([
62
+ 'ftp://example.com/file.txt',
63
+ 'myapp://some/path/file.txt',
64
65
66
67
+ test('prepends https:// to IP addresses with ports', () => {
68
+ expect(joinUrls(['192.168.1.1:8080', '10.0.0.1:3000/api'], 'file.txt')).toEqual([
69
+ 'https://192.168.1.1:8080/file.txt',
70
+ 'https://10.0.0.1:3000/api/file.txt',
71
72
73
0 commit comments