mirror of
https://gh-proxy.org/https://github.com/klinsmaya/multica.git
synced 2026-11-10 02:16:45 +08:00
* test: remove implementation-only coverage Co-authored-by: multica-agent <[email protected]> * test: remove remaining implementation-only coverage Co-authored-by: multica-agent <[email protected]> * test: restore compatibility and fragment navigation coverage Co-authored-by: multica-agent <[email protected]> * test: preserve behavioral cleanup contracts Co-authored-by: multica-agent <[email protected]> --------- Co-authored-by: Sol-Boy <[email protected]> Co-authored-by: multica-agent <[email protected]>
19 lines
651 B
TypeScript
19 lines
651 B
TypeScript
// @vitest-environment node
|
|
import { describe, expect, it } from "vitest";
|
|
import { hashString } from "./hash-string";
|
|
|
|
describe("hashString", () => {
|
|
it("differs for different inputs (collision-resistant enough for contentKey)", () => {
|
|
expect(hashString("<p>a</p>")).not.toBe(hashString("<p>b</p>"));
|
|
});
|
|
|
|
it("produces [a-z0-9]+ tokens (safe to inline as a JS string without escaping)", () => {
|
|
const token = hashString("<h1>标题 😀</h1>\n<script>alert(1)</script>");
|
|
expect(token).toMatch(/^[a-z0-9]+$/);
|
|
});
|
|
|
|
it("hashes empty string without throwing", () => {
|
|
expect(hashString("")).toMatch(/^[a-z0-9]+$/);
|
|
});
|
|
});
|