refactor: move encode HTML function tests into separate module (#4593)

Co-authored-by: Alexandr <qwerty541zxc@gmail.com>
This commit is contained in:
Alexandr Garbuzov
2025-10-25 20:29:53 +02:00
committed by martin-mfg
co-authored by Alexandr
parent dd3c8472fb
commit 9ed6f2d361
2 changed files with 10 additions and 7 deletions
+10
View File
@@ -0,0 +1,10 @@
import { describe, expect, it } from "@jest/globals";
import { encodeHTML } from "../src/common/html.js";
describe("Test html.js", () => {
it("should test encodeHTML", () => {
expect(encodeHTML(`<html>hello world<,.#4^&^@%!))`)).toBe(
"&#60;html&#62;hello world&#60;,.#4^&#38;^@%!))",
);
});
});
-7
View File
@@ -4,15 +4,8 @@ import { describe, expect, it } from "@jest/globals";
import { queryByTestId } from "@testing-library/dom";
import "@testing-library/jest-dom/jest-globals";
import { renderError } from "../src/common/render.js";
import { encodeHTML } from "../src/common/html.js";
describe("Test render.js", () => {
it("should test encodeHTML", () => {
expect(encodeHTML(`<html>hello world<,.#4^&^@%!))`)).toBe(
"&#60;html&#62;hello world&#60;,.#4^&#38;^@%!))",
);
});
it("should test renderError", () => {
document.body.innerHTML = renderError({ message: "Something went wrong" });
expect(