LibJS: Add the global escape() & unescape() methods

This commit is contained in:
Idan Horowitz 2021-06-05 19:21:15 +03:00 committed by Linus Groh
commit 442ef63008
Notes: sideshowbarker 2024-07-18 16:50:34 +09:00
4 changed files with 69 additions and 0 deletions

View file

@ -0,0 +1,21 @@
test("escape", () => {
[
["abc123", "abc123"],
["äöü", "%E4%F6%FC"],
["ć", "%u0107"],
["@*_+-./", "@*_+-./"],
].forEach(test => {
expect(escape(test[0])).toBe(test[1]);
});
});
test("unescape", () => {
[
["abc123", "abc123"],
["%E4%F6%FC", "äöü"],
["%u0107", "ć"],
["@*_+-./", "@*_+-./"],
].forEach(test => {
expect(unescape(test[0])).toBe(test[1]);
});
});