Skip to content

Commit f5de29f

Browse files
refactor: move encode HTML function tests into separate module (anuraghazra#4593)
Co-authored-by: Alexandr <qwerty541zxc@gmail.com>
1 parent a72d88f commit f5de29f

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

tests/html.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { describe, expect, it } from "@jest/globals";
2+
import { encodeHTML } from "../src/common/html.js";
3+
4+
describe("Test html.js", () => {
5+
it("should test encodeHTML", () => {
6+
expect(encodeHTML(`<html>hello world<,.#4^&^@%!))`)).toBe(
7+
"&#60;html&#62;hello world&#60;,.#4^&#38;^@%!))",
8+
);
9+
});
10+
});

tests/render.test.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,8 @@ import { describe, expect, it } from "@jest/globals";
44
import { queryByTestId } from "@testing-library/dom";
55
import "@testing-library/jest-dom/jest-globals";
66
import { renderError } from "../src/common/render.js";
7-
import { encodeHTML } from "../src/common/html.js";
87

98
describe("Test render.js", () => {
10-
it("should test encodeHTML", () => {
11-
expect(encodeHTML(`<html>hello world<,.#4^&^@%!))`)).toBe(
12-
"&#60;html&#62;hello world&#60;,.#4^&#38;^@%!))",
13-
);
14-
});
15-
169
it("should test renderError", () => {
1710
document.body.innerHTML = renderError({ message: "Something went wrong" });
1811
expect(

0 commit comments

Comments
 (0)