Use UTF-8 safe return-to encoding and decoding across router and login
Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
21
tests/unit/utils/returnToEncoding.test.js
Normal file
21
tests/unit/utils/returnToEncoding.test.js
Normal file
@@ -0,0 +1,21 @@
|
||||
// The Lucia project.
|
||||
// Copyright 2026-2026 DSP, inc. All rights reserved.
|
||||
// Authors:
|
||||
// imacat.yang@dsp.im (imacat), 2026/03/08
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { encodeReturnTo, decodeReturnTo } from "@/utils/returnToEncoding";
|
||||
|
||||
describe("returnToEncoding", () => {
|
||||
it("round-trips ASCII paths", () => {
|
||||
const original = "/discover/log/1/map?view=summary#node-2";
|
||||
const encoded = encodeReturnTo(original);
|
||||
expect(decodeReturnTo(encoded)).toBe(original);
|
||||
});
|
||||
|
||||
it("round-trips Unicode paths without throwing", () => {
|
||||
const original = "/files?keyword=流程圖#節點";
|
||||
const encoded = encodeReturnTo(original);
|
||||
expect(decodeReturnTo(encoded)).toBe(original);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user