mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-26 00:51:12 +00:00
24 lines
1023 B
TypeScript
24 lines
1023 B
TypeScript
// Shared HTML entity tests cover all agent renderers and tool-argument repair callers.
|
|
import { describe, expect, it } from "vitest";
|
|
import { decodeHtmlEntities } from "./html-entities.js";
|
|
|
|
describe("decodeHtmlEntities", () => {
|
|
it("decodes HTML5 named entities beyond the XML subset", () => {
|
|
expect(decodeHtmlEntities("— © … ")).toBe("— © … \u00a0");
|
|
});
|
|
|
|
it("uses exact HTML5 names before the legacy case-insensitive fallback", () => {
|
|
expect(decodeHtmlEntities("≪ ≫ &lT; &gT; &Apos; &aMp;")).toBe("≪ ≫ < > ' &");
|
|
});
|
|
|
|
it("decodes decimal and hexadecimal astral entities without truncation", () => {
|
|
expect(decodeHtmlEntities("😀 😀")).toBe("😀 😀");
|
|
});
|
|
|
|
it("keeps direct numeric mapping, single-pass decoding, and invalid scalar references", () => {
|
|
expect(
|
|
decodeHtmlEntities("€ � &#39; &mdash; � � �"),
|
|
).toBe("\u0080 \0 ' — � � �");
|
|
});
|
|
});
|