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-17 22:40:48 +03:00
committed by GitHub
co-authored by Alexandr
parent a72d88fd54
commit f5de29fa67
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(