aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/utils.test.js
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-02-08 00:08:44 +0800
committerGitHub <noreply@github.com>2023-02-08 00:08:44 +0800
commit2c6cc0b8c982b3d49a5b208f75e15b2269584312 (patch)
tree09746485be5f6c534082585f137c921d6a34ab75 /web_src/js/utils.test.js
parentd5fa2e7510844ad092804b7c11bf6847f7c4e45d (diff)
downloadgitea-2c6cc0b8c982b3d49a5b208f75e15b2269584312.tar.gz
gitea-2c6cc0b8c982b3d49a5b208f75e15b2269584312.zip
Fix links for the menus in the view file page (#22795)
Diffstat (limited to 'web_src/js/utils.test.js')
-rw-r--r--web_src/js/utils.test.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/web_src/js/utils.test.js b/web_src/js/utils.test.js
index 4efe916231..306acd34af 100644
--- a/web_src/js/utils.test.js
+++ b/web_src/js/utils.test.js
@@ -139,6 +139,11 @@ test('blobToDataURI', async () => {
});
test('toAbsoluteUrl', () => {
+ expect(toAbsoluteUrl('//host/dir')).toEqual('http://host/dir');
+ expect(toAbsoluteUrl('https://host/dir')).toEqual('https://host/dir');
+
expect(toAbsoluteUrl('')).toEqual('http://localhost:3000');
expect(toAbsoluteUrl('/user/repo')).toEqual('http://localhost:3000/user/repo');
+
+ expect(() => toAbsoluteUrl('path')).toThrowError('unsupported');
});