Skip to content

Commit 79f9fa7

Browse files
committed
Fix tests
1 parent 91fff6a commit 79f9fa7

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

test/index.js

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@ tester.describe("json2md", test => {
77
test.it("should support headings", function(cb) {
88
test.expect(json2md({
99
h1: "Heading 1"
10-
})).toBe("# Heading 1");
10+
})).toBe("# Heading 1\n");
1111
test.expect(json2md({
1212
h2: "Heading 2"
13-
})).toBe("## Heading 2");
13+
})).toBe("## Heading 2\n");
1414
test.expect(json2md({
1515
h3: "Heading 3"
16-
})).toBe("### Heading 3");
16+
})).toBe("### Heading 3\n");
1717
test.expect(json2md({
1818
h4: "Heading 4"
19-
})).toBe("#### Heading 4");
19+
})).toBe("#### Heading 4\n");
2020
test.expect(json2md({
2121
h5: "Heading 5"
22-
})).toBe("##### Heading 5");
22+
})).toBe("##### Heading 5\n");
2323
test.expect(json2md({
2424
h6: "Heading 6"
25-
})).toBe("###### Heading 6");
25+
})).toBe("###### Heading 6\n");
2626
cb();
2727
});
2828

@@ -51,7 +51,7 @@ tester.describe("json2md", test => {
5151
ul: [
5252
"item 1", "item 2"
5353
]
54-
})).toBe("\n - item 1\n - item 2");
54+
})).toBe("\n - item 1\n - item 2\n");
5555
cb();
5656
});
5757

@@ -60,7 +60,7 @@ tester.describe("json2md", test => {
6060
ul: [
6161
"<em>item 1</em>", "<bold>item 2</bold>"
6262
]
63-
})).toBe("\n - *item 1*\n - **item 2**");
63+
})).toBe("\n - *item 1*\n - **item 2**\n");
6464
cb();
6565
});
6666

@@ -70,7 +70,7 @@ tester.describe("json2md", test => {
7070
ol: [
7171
"item 1", "item 2"
7272
]
73-
})).toBe("\n 1. item 1\n 2. item 2");
73+
})).toBe("\n 1. item 1\n 2. item 2\n");
7474
cb();
7575
});
7676

@@ -80,10 +80,13 @@ tester.describe("json2md", test => {
8080
code: {
8181
language: "js",
8282
content: [
83-
"function sum (a, b) {", " return a + b;", "}", "sum(1, 2);"
83+
"function sum (a, b) {",
84+
" return a + b;",
85+
"}",
86+
"sum(1, 2);"
8487
]
8588
}
86-
})).toBe("```js\nfunction sum (a, b) {\n return a + b;\n}\nsum(1, 2);\n```");
89+
})).toBe("```js\nfunction sum (a, b) {\n return a + b;\n}\nsum(1, 2);\n```\n");
8790
cb();
8891
});
8992

@@ -113,7 +116,7 @@ tester.describe("json2md", test => {
113116
};
114117
test.expect(json2md({
115118
sayHello: "World"
116-
})).toBe("Hello World!")
119+
})).toBe("Hello World!\n")
117120
cb();
118121
});
119122

@@ -126,7 +129,10 @@ tester.describe("json2md", test => {
126129
code: {
127130
language: "js",
128131
content: [
129-
"function sum (a, b) {", " return a + b;", "}", "sum(1, 2);"
132+
"function sum (a, b) {",
133+
" return a + b;",
134+
"}",
135+
"sum(1, 2);"
130136
]
131137
}
132138
}
@@ -139,7 +145,8 @@ tester.describe("json2md", test => {
139145
return a + b;
140146
}
141147
sum(1, 2);
142-
\`\`\``);
148+
\`\`\`
149+
\n`);
143150
cb();
144151
});
145152

@@ -164,7 +171,8 @@ tester.describe("json2md", test => {
164171
return a + b;
165172
}
166173
sum(1, 2);
167-
\`\`\``);
174+
\`\`\`
175+
\n`);
168176
cb();
169177
});
170178

@@ -184,7 +192,7 @@ tester.describe("json2md", test => {
184192
b: "col2"
185193
}]
186194
}
187-
})).toBe("a | b\n--- | ---\ncol1 | col2");
195+
})).toBe("a | b\n--- | ---\ncol1 | col2\n");
188196
cb();
189197
})
190198

@@ -196,7 +204,7 @@ tester.describe("json2md", test => {
196204
["col1", "col2"]
197205
]
198206
}
199-
})).toBe("a | b\n--- | ---\ncol1 | col2");
207+
})).toBe("a | b\n--- | ---\ncol1 | col2\n");
200208
cb();
201209
})
202210
});

0 commit comments

Comments
 (0)