Skip to content

Commit b547186

Browse files
committed
setup single hint
Signed-off-by: shmck <[email protected]>
1 parent df85d46 commit b547186

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

tests/parse.test.ts

+63
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,69 @@ The first step
11891189
expect(result.levels).toEqual(expected.levels);
11901190
});
11911191

1192+
it("should parse a single hint", () => {
1193+
const md = `# Title
1194+
1195+
Description.
1196+
1197+
## 1. Title 1
1198+
1199+
First level content.
1200+
1201+
### 1.1
1202+
1203+
The first step
1204+
1205+
#### HINTS
1206+
1207+
- A test with a \`backtick\`
1208+
1209+
`;
1210+
const skeleton = {
1211+
levels: [
1212+
{
1213+
id: "1",
1214+
steps: [
1215+
{
1216+
id: "1.1",
1217+
},
1218+
],
1219+
},
1220+
],
1221+
};
1222+
const result = parse({
1223+
text: md,
1224+
skeleton,
1225+
commits: {
1226+
"1.1:T": ["abcdef1", "123456789"],
1227+
},
1228+
});
1229+
const expected = {
1230+
summary: {
1231+
description: "Description.",
1232+
},
1233+
levels: [
1234+
{
1235+
id: "1",
1236+
title: "Title 1",
1237+
summary: "First level content.",
1238+
content: "First level content.",
1239+
steps: [
1240+
{
1241+
id: "1.1",
1242+
content: "The first step",
1243+
setup: {
1244+
commits: ["abcdef1", "123456789"],
1245+
},
1246+
hints: ["A test with a `backtick`"],
1247+
},
1248+
],
1249+
},
1250+
],
1251+
};
1252+
expect(result.levels).toEqual(expected.levels);
1253+
});
1254+
11921255
it("should parse hints for a step with '-'", () => {
11931256
const md = `# Title
11941257

0 commit comments

Comments
 (0)