markdown-maker 1.10.2 → 1.10.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,41 +0,0 @@
1
- const fs = require("fs");
2
- const assert = require("assert");
3
- const Parser = require("../bundle/parser");
4
- const path = require("path");
5
- const html = require("node-html-parser");
6
-
7
- /* make folder for temporary files, if it doesn't exist */
8
- if (
9
- !fs.existsSync("test/test-files") ||
10
- !fs.lstatSync("test/test-files").isDirectory()
11
- ) {
12
- fs.mkdirSync("test/test-files");
13
- }
14
-
15
- /**
16
- * Create a new file under `test/test-files` with the given content.
17
- * @param {string} text
18
- * @param {string} file
19
- */
20
- function put(text, file) {
21
- fs.writeFileSync(path.join("test", "test-files", file), text);
22
- }
23
- function putDir(name) {
24
- fs.mkdirSync(path.join("test", "test-files", name));
25
- }
26
-
27
- const TargetType = {
28
- HTML: 0,
29
- MARKDOWN: 1,
30
- };
31
-
32
- module.exports = {
33
- assert,
34
- fs,
35
- html,
36
- path,
37
- Parser,
38
- put,
39
- putDir,
40
- TargetType,
41
- };
package/test/vars.test.js DELETED
@@ -1,49 +0,0 @@
1
- const util = require("./tester.test.js");
2
-
3
- describe("Use variables", () => {
4
- it("should replace var with the value", () => {
5
- const output = new util.Parser("#mddef<hi=yo>\n#mdvar<hi>").get();
6
-
7
- util.assert.strictEqual(output, "\nyo\n\n");
8
- });
9
- it("should use variable shorthand", () => {
10
- const output = new util.Parser("#mddef<hi=yo>\n<hi>").get();
11
-
12
- util.assert.strictEqual(output, "\nyo\n\n");
13
- });
14
- it("should use variables across files", () => {
15
- util.put("#mddef<hi=yo>\n#mdinclude<sample2.md>", "sample1.md");
16
- util.put("<hi>", "sample2.md");
17
-
18
- const output = new util.Parser("test/test-files/sample1.md").get();
19
-
20
- util.assert.strictEqual(output, "\nyo\n\n");
21
- });
22
- it("should throw if undefined variable", () => {
23
- const parser = new util.Parser("<yo>");
24
-
25
- let e;
26
- /* should throw an error */
27
- util.assert.throws(() => {
28
- try {
29
- parser.get();
30
- } catch (_e) {
31
- e = _e;
32
- throw _e;
33
- }
34
- });
35
- });
36
-
37
- it("should preserve whatever comes after", () => {
38
- const output = new util.Parser("#mddef<hi=yo>\n<hi>,").get();
39
- util.assert.strictEqual(output, "\nyo,\n\n");
40
- });
41
-
42
- it("should replace underscore with space", () => {
43
- const output = new util.Parser(
44
- "#mddef<name=Mr_Sir>\n#mdvar<name>"
45
- ).get();
46
-
47
- util.assert.strictEqual(output, "\nMr Sir\n\n");
48
- });
49
- });