refactor: move encode HTML function tests into separate module (#4593)
Co-authored-by: Alexandr <qwerty541zxc@gmail.com>
This commit is contained in:
1 parent
a72d88fd54
commit
f5de29fa67
2 files changed
+10
-7
No files matched your search
@@ -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(
|
||||||
|
"<html>hello world<,.#4^&^@%!))",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -4,15 +4,8 @@ import { describe, expect, it } from "@jest/globals";
|
|||||||
import { queryByTestId } from "@testing-library/dom";
|
import { queryByTestId } from "@testing-library/dom";
|
||||||
import "@testing-library/jest-dom/jest-globals";
|
import "@testing-library/jest-dom/jest-globals";
|
||||||
import { renderError } from "../src/common/render.js";
|
import { renderError } from "../src/common/render.js";
|
||||||
import { encodeHTML } from "../src/common/html.js";
|
|
||||||
|
|
||||||
describe("Test render.js", () => {
|
describe("Test render.js", () => {
|
||||||
it("should test encodeHTML", () => {
|
|
||||||
expect(encodeHTML(`<html>hello world<,.#4^&^@%!))`)).toBe(
|
|
||||||
"<html>hello world<,.#4^&^@%!))",
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should test renderError", () => {
|
it("should test renderError", () => {
|
||||||
document.body.innerHTML = renderError({ message: "Something went wrong" });
|
document.body.innerHTML = renderError({ message: "Something went wrong" });
|
||||||
expect(
|
expect(
|
||||||
|
|||||||
Reference in new issue
Block a user