Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b8ac545

Browse files
committed
test single hint on final level
Signed-off-by: shmck <[email protected]>
1 parent 6fe672d commit b8ac545

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

tests/parse.test.ts

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,90 @@ The second uninterrupted step
14751475
};
14761476
expect(result.levels[0]).toEqual(expected.levels[0]);
14771477
});
1478+
it('should work with a single test on the final lesson', () => {
1479+
// issue: https://github.com/coderoad/coderoad-vscode/issues/480
1480+
const md = `# Title
1481+
1482+
Description.
1483+
1484+
## 1. Title 1
1485+
1486+
First level content.
1487+
1488+
### 1.1
1489+
1490+
The first step
1491+
1492+
### 1.2
1493+
1494+
The second uninterrupted step
1495+
1496+
#### HINTS
1497+
1498+
* First Hint with \`markdown\`. See **bold**`;
1499+
const skeleton = {
1500+
levels: [
1501+
{
1502+
id: "1",
1503+
steps: [
1504+
{
1505+
id: "1.1",
1506+
},
1507+
{
1508+
id: "1.2",
1509+
},
1510+
],
1511+
},
1512+
],
1513+
};
1514+
const result = parse({
1515+
text: md,
1516+
skeleton,
1517+
commits: {
1518+
"1.1:T": ["abcdef1"],
1519+
"1.1:S": ["123456789"],
1520+
"1.2:T": ["fedcba1"],
1521+
},
1522+
});
1523+
const expected = {
1524+
summary: {
1525+
description: "Description.",
1526+
},
1527+
levels: [
1528+
{
1529+
id: "1",
1530+
title: "Title 1",
1531+
summary: "First level content.",
1532+
content: "First level content.",
1533+
steps: [
1534+
{
1535+
id: "1.1",
1536+
content: "The first step",
1537+
setup: {
1538+
commits: ["abcdef1"],
1539+
},
1540+
solution: {
1541+
commits: ["123456789"],
1542+
},
1543+
1544+
},
1545+
{
1546+
id: "1.2",
1547+
content: "The second uninterrupted step",
1548+
setup: {
1549+
commits: ["fedcba1"],
1550+
},
1551+
hints: [
1552+
"First Hint with `markdown`. See **bold**"
1553+
],
1554+
},
1555+
],
1556+
},
1557+
{},
1558+
],
1559+
};
1560+
expect(result.levels[0]).toEqual(expected.levels[0]);
1561+
})
14781562
});
14791563
describe("subtasks", () => {
14801564
it("should parse subtasks", () => {

0 commit comments

Comments
 (0)