Skip to content

Fix/id order #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 25, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add out of order id test
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Jun 25, 2020
commit 14418938307450c263be482ade312cc56ff920fe
102 changes: 102 additions & 0 deletions tests/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,108 @@ The first step
});
});

it("should load when commits are not in direct order (100, 200, 201)", () => {
const md = `# Title

Description.

## 100. Title

First line

### 100.1

The first step

## 200. Title

First line

### 200.1

The first step

## 201. Title

First line

### 201.1

The first step
`;
const skeleton = {
levels: [
{
id: "100",
steps: [{ id: "100.1" }],
},
{
id: "200",
steps: [{ id: "200.1" }],
},
{
id: "201",
steps: [{ id: "201.1" }],
},
],
};
const result = parse({
text: md,
skeleton,
commits: {},
});
const expected = {
summary: {
description: "Description.",
},
levels: [
{
id: "100",
summary: "First line",
content: "First line",
steps: [
{
id: "100.1",
content: "The first step",
setup: {
commits: [],
},
},
],
},
{
id: "200",
summary: "Second line",
content: "Second line",
steps: [
{
id: "200.1",
content: "The second step",
setup: {
commits: [],
},
},
],
},
{
id: "201",
summary: "Third line",
content: "Third line",
steps: [
{
id: "201.1",
content: "The third step",
setup: {
commits: [],
},
},
],
},
],
};
expect(result.levels).toEqual(expected.levels);
});

describe("config", () => {
it("should parse the tutorial config", () => {
const md = `# Title
Expand Down