initial commit

This commit is contained in:
Géry Debongnie
2019-01-16 11:28:05 +01:00
commit 0f3b2d10da
10 changed files with 1293 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import { escape, htmlTrim } from "../src/utils";
describe("escape", () => {
test("normal strings", () => {
const text = "abc";
expect(escape(text)).toBe(text);
});
test("special symbols", () => {
const text = "<ok>";
expect(escape(text)).toBe("&lt;ok&gt;");
});
});
describe("htmlTrim", () => {
test("basic use", () => {
expect(htmlTrim("abc")).toBe("abc");
expect(htmlTrim(" abc")).toBe(" abc");
expect(htmlTrim("abc ")).toBe("abc ");
expect(htmlTrim(" abc ")).toBe(" abc ");
expect(htmlTrim("abc\n ")).toBe("abc ");
expect(htmlTrim("\n ")).toBe(" ");
expect(htmlTrim(" \n ")).toBe(" ");
expect(htmlTrim(" ")).toBe(" ");
expect(htmlTrim("")).toBe("");
});
});