Skip to content

Commit fa641d7

Browse files
committed
summary parse test
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent e27add1 commit fa641d7

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

package.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@
4343
},
4444
"jest": {
4545
"preset": "ts-jest",
46-
"testEnvironment": "node"
46+
"verbose": true,
47+
"testPathIgnorePatterns": [
48+
"build"
49+
],
50+
"moduleFileExtensions": [
51+
"js",
52+
"ts"
53+
]
4754
}
4855
}

src/build.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const workingDir = "tmp";
1212

1313
type TutorialContent = {};
1414

15-
function parseContent(md: string): TutorialContent {
15+
export function parseContent(md: string): TutorialContent {
1616
let start: number = -1;
1717
const parts: any[] = [];
1818

tests/parseMd.test.ts

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { parseContent } from "../src/build";
2+
3+
describe("parse", () => {
4+
it("should parse summary", () => {
5+
const md = `# Insert Tutorial's Title here
6+
7+
Short description to be shown as a tutorial's subtitle.
8+
9+
`;
10+
11+
const result = parseContent(md);
12+
const expected = {
13+
summary: {
14+
description: "Short description to be shown as a tutorial's subtitle.",
15+
title: "Insert Tutorial's Title here",
16+
},
17+
};
18+
expect(result).toEqual(expected);
19+
});
20+
});

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
"removeComments": true,
2323
"skipLibCheck": true
2424
},
25-
"exclude": [".vscode", "bin", "build", "test"]
25+
"exclude": ["node_modules", ".vscode", "bin", "build", "tests"]
2626
}

0 commit comments

Comments
 (0)