diff options
author | silverwind <me@silverwind.io> | 2023-08-31 04:46:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-31 02:46:44 +0000 |
commit | c35b16a9a491ffbd093bf3e759e94cdbc960fe9c (patch) | |
tree | 0c642bb55079fe8b3ef6072a10bdbe85c4c50686 /web_src/js/utils.test.js | |
parent | 19a1e1b20ee45f02908c915c8540baab1396899c (diff) | |
download | gitea-c35b16a9a491ffbd093bf3e759e94cdbc960fe9c.tar.gz gitea-c35b16a9a491ffbd093bf3e759e94cdbc960fe9c.zip |
Remove joinPaths function (#26833)
Extract from https://github.com/go-gitea/gitea/pull/25940.
`assetUrlPrefix` is guaranteed to not contain trailing slashes, making
this function unneeded.
Diffstat (limited to 'web_src/js/utils.test.js')
-rw-r--r-- | web_src/js/utils.test.js | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/web_src/js/utils.test.js b/web_src/js/utils.test.js index 6648b669c7..db9b1a14a3 100644 --- a/web_src/js/utils.test.js +++ b/web_src/js/utils.test.js @@ -1,6 +1,6 @@ import {expect, test} from 'vitest'; import { - basename, extname, isObject, stripTags, joinPaths, parseIssueHref, + basename, extname, isObject, stripTags, parseIssueHref, parseUrl, translateMonth, translateDay, blobToDataURI, toAbsoluteUrl, encodeURLEncodedBase64, decodeURLEncodedBase64, } from './utils.js'; @@ -18,45 +18,6 @@ test('extname', () => { expect(extname('file.js')).toEqual('.js'); }); -test('joinPaths', () => { - expect(joinPaths('', '')).toEqual(''); - expect(joinPaths('', 'b')).toEqual('b'); - expect(joinPaths('', '/b')).toEqual('/b'); - expect(joinPaths('', '/b/')).toEqual('/b/'); - expect(joinPaths('a', '')).toEqual('a'); - expect(joinPaths('/a', '')).toEqual('/a'); - expect(joinPaths('/a/', '')).toEqual('/a/'); - expect(joinPaths('a', 'b')).toEqual('a/b'); - expect(joinPaths('a', '/b')).toEqual('a/b'); - expect(joinPaths('/a', '/b')).toEqual('/a/b'); - expect(joinPaths('/a', '/b')).toEqual('/a/b'); - expect(joinPaths('/a/', '/b')).toEqual('/a/b'); - expect(joinPaths('/a', '/b/')).toEqual('/a/b/'); - expect(joinPaths('/a/', '/b/')).toEqual('/a/b/'); - - expect(joinPaths('', '', '')).toEqual(''); - expect(joinPaths('', 'b', '')).toEqual('b'); - expect(joinPaths('', 'b', 'c')).toEqual('b/c'); - expect(joinPaths('', '', 'c')).toEqual('c'); - expect(joinPaths('', '/b', '/c')).toEqual('/b/c'); - expect(joinPaths('/a', '', '/c')).toEqual('/a/c'); - expect(joinPaths('/a', '/b', '')).toEqual('/a/b'); - - expect(joinPaths('', '/')).toEqual('/'); - expect(joinPaths('a', '/')).toEqual('a/'); - expect(joinPaths('', '/', '/')).toEqual('/'); - expect(joinPaths('/', '/')).toEqual('/'); - expect(joinPaths('/', '')).toEqual('/'); - expect(joinPaths('/', 'b')).toEqual('/b'); - expect(joinPaths('/', 'b/')).toEqual('/b/'); - expect(joinPaths('/', '', '/')).toEqual('/'); - expect(joinPaths('/', 'b', '/')).toEqual('/b/'); - expect(joinPaths('/', 'b/', '/')).toEqual('/b/'); - expect(joinPaths('a', '/', '/')).toEqual('a/'); - expect(joinPaths('/', '/', 'c')).toEqual('/c'); - expect(joinPaths('/', '/', 'c/')).toEqual('/c/'); -}); - test('isObject', () => { expect(isObject({})).toBeTruthy(); expect(isObject([])).toBeFalsy(); |