-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtilities.test.js
More file actions
83 lines (81 loc) · 3.28 KB
/
Utilities.test.js
File metadata and controls
83 lines (81 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
const { parseMarkdownToHTML, parseHTMLToMarkdown } = require("./Utilities");
// console.log(expect("h"));
describe("Markdown to HTML", () => {
it("Should contain h1", () => {
const h1Mark = "# Hello world";
const parsedH1 = parseMarkdownToHTML(h1Mark);
expect(parsedH1).toContain("<h1>Hello world</h1>");
});
it("Should contain h2", () => {
const h1Mark = "## Hello world";
const parsedH1 = parseMarkdownToHTML(h1Mark);
expect(parsedH1).toContain("<h2>Hello world</h2>");
});
it("Should contain h3", () => {
const h1Mark = "### Hello world";
const parsedH1 = parseMarkdownToHTML(h1Mark);
expect(parsedH1).toContain("<h3>Hello world</h3>");
});
it("Should contain h4", () => {
const h1Mark = "#### Hello world";
const parsedH1 = parseMarkdownToHTML(h1Mark);
expect(parsedH1).toContain("<h4>Hello world</h4>");
});
it("Should contain h5", () => {
const h1Mark = "##### Hello world";
const parsedH1 = parseMarkdownToHTML(h1Mark);
expect(parsedH1).toContain("<h5>Hello world</h5>");
});
it("Should contain h6", () => {
const h1Mark = "###### Hello world";
const parsedH1 = parseMarkdownToHTML(h1Mark);
expect(parsedH1).toContain("<h6>Hello world</h6>");
});
});
describe("HTML to Markdown", () => {
it("Should contain #", () => {
const markH1 = "<h1>Hello world</h1>";
const markParse = parseHTMLToMarkdown(markH1);
expect(markParse).toContain("# Hello world");
});
it("Should contain ##", () => {
const markH1 = "<h2>Hello world</h2>";
const markParse = parseHTMLToMarkdown(markH1);
expect(markParse).toContain("## Hello world");
});
it("Should contain ###", () => {
const markH1 = "<h3>Hello world</h3>";
const markParse = parseHTMLToMarkdown(markH1);
expect(markParse).toContain("### Hello world");
});
it("Should contain ####", () => {
const markH1 = "<h4>Hello world</h4>";
const markParse = parseHTMLToMarkdown(markH1);
expect(markParse).toContain("#### Hello world");
});
it("Should contain #####", () => {
const markH1 = "<h5>Hello world</h5>";
const markParse = parseHTMLToMarkdown(markH1);
expect(markParse).toContain("##### Hello world");
});
it("Should contain #####", () => {
const markH1 = "<h6>Hello world</h6>";
const markParse = parseHTMLToMarkdown(markH1);
expect(markParse).toContain("###### Hello world");
});
it("Should contain ", () => {
const markH1 = "<img alt='profile photo' src='./profile.png' />";
const markParse = parseHTMLToMarkdown(markH1);
expect(markParse).toContain("");
});
it("Should contain [innerText](href)", () => {
const markH1 = "<a href='./about.html'>About</a>";
const markParse = parseHTMLToMarkdown(markH1);
expect(markParse).toContain("[About](./about.html)");
});
it("Should contain ```code```", () => {
const markH1 = "<code>console.log('Hello world');</code>";
const markParse = parseHTMLToMarkdown(markH1);
expect(markParse).toContain("```console.log('Hello world');```");
});
});