aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/utils.test.js
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2023-06-06 06:29:37 +0100
committerGitHub <noreply@github.com>2023-06-06 13:29:37 +0800
commit036fb7861fb8fb12f1dcabbd8edab9b322b7c96c (patch)
tree53866bb0ed5cdfc8b1c000871e4f2d6e3119cc67 /web_src/js/utils.test.js
parentc09f747b516f52b16f3d699e5f115789600a432a (diff)
downloadgitea-036fb7861fb8fb12f1dcabbd8edab9b322b7c96c.tar.gz
gitea-036fb7861fb8fb12f1dcabbd8edab9b322b7c96c.zip
Clean up WebAuthn javascript code and remove JQuery code (#22697)
There were several issues with the WebAuthn registration and testing code and the style was very old javascript with jquery callbacks. This PR uses async and fetch to replace the JQuery code. Ref #22651 Signed-off-by: Andrew Thornton <art27@cantab.net> --------- Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'web_src/js/utils.test.js')
-rw-r--r--web_src/js/utils.test.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/web_src/js/utils.test.js b/web_src/js/utils.test.js
index 2f9e5fb47d..cf73b63b99 100644
--- a/web_src/js/utils.test.js
+++ b/web_src/js/utils.test.js
@@ -2,7 +2,7 @@ import {expect, test} from 'vitest';
import {
basename, extname, isObject, stripTags, joinPaths, parseIssueHref,
parseUrl, translateMonth, translateDay, blobToDataURI,
- toAbsoluteUrl,
+ toAbsoluteUrl, encodeURLEncodedBase64, decodeURLEncodedBase64,
} from './utils.js';
test('basename', () => {
@@ -132,3 +132,9 @@ test('toAbsoluteUrl', () => {
expect(() => toAbsoluteUrl('path')).toThrowError('unsupported');
});
+
+test('encodeURLEncodedBase64, decodeURLEncodedBase64', () => {
+ expect(encodeURLEncodedBase64(decodeURLEncodedBase64('foo'))).toEqual('foo'); // No = padding
+ expect(encodeURLEncodedBase64(decodeURLEncodedBase64('a-minus'))).toEqual('a-minus');
+ expect(encodeURLEncodedBase64(decodeURLEncodedBase64('_underscorc'))).toEqual('_underscorc');
+});