mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 22:19:48 +00:00
Moves the encodeHashComponent and decodeHashComponent functions out of hash_util and into internal_url which belongs to shared. This is to accommodate sharing of this code with mobile or any other codebases that do not wish to duplicate logic.
23 lines
742 B
JavaScript
23 lines
742 B
JavaScript
"use strict";
|
|
|
|
const {strict: assert} = require("assert");
|
|
|
|
const {zrequire} = require("../zjsunit/namespace");
|
|
const {run_test} = require("../zjsunit/test");
|
|
|
|
const internal_url = zrequire("../shared/js/internal_url");
|
|
|
|
run_test("test encodeHashComponent", () => {
|
|
const decoded = "https://www.zulipexample.com";
|
|
const encoded = "https.3A.2F.2Fwww.2Ezulipexample.2Ecom";
|
|
const result = internal_url.encodeHashComponent(decoded);
|
|
assert.equal(result, encoded);
|
|
});
|
|
|
|
run_test("test decodeHashComponent", () => {
|
|
const decoded = "https://www.zulipexample.com";
|
|
const encoded = "https.3A.2F.2Fwww.2Ezulipexample.2Ecom";
|
|
const result = internal_url.decodeHashComponent(encoded);
|
|
assert.equal(result, decoded);
|
|
});
|