Skip to content

Feature/subtasks #57

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
Jul 5, 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
Next Next commit
add subtask test
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Jul 5, 2020
commit 7e86b0cbb038d3f363daac9fbd4b9ec252b7ddfa
78 changes: 70 additions & 8 deletions tests/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,6 @@ The first step
files: ["someFile.js"],
watchers: ["someFile.js"],
filter: "someFilter",
subtasks: true,
},
solution: {
commands: ["npm install"],
Expand Down Expand Up @@ -579,7 +578,6 @@ The first step
files: ["someFile.js"],
watchers: ["someFile.js"],
filter: "someFilter",
subtasks: true,
},
solution: {
commits: ["1gfedcba", "987654321"],
Expand Down Expand Up @@ -631,7 +629,6 @@ The third step
files: ["someFile.js"],
watchers: ["someFile.js"],
filter: "someFilter",
subtasks: true,
},
solution: {
commands: ["npm install"],
Expand All @@ -645,7 +642,6 @@ The third step
files: ["someFile.js"],
watchers: ["someFile.js"],
filter: "someFilter",
subtasks: true,
},
solution: {
commands: ["npm install"],
Expand All @@ -666,7 +662,6 @@ The third step
files: ["someFile.js"],
watchers: ["someFile.js"],
filter: "someFilter",
subtasks: true,
},
solution: {
commands: ["npm install"],
Expand Down Expand Up @@ -709,7 +704,6 @@ The third step
files: ["someFile.js"],
watchers: ["someFile.js"],
filter: "someFilter",
subtasks: true,
},
solution: {
commits: ["1fedcba", "987654321"],
Expand All @@ -726,7 +720,6 @@ The third step
files: ["someFile.js"],
watchers: ["someFile.js"],
filter: "someFilter",
subtasks: true,
},
solution: {
commits: ["3abcdef"],
Expand All @@ -751,7 +744,6 @@ The third step
files: ["someFile.js"],
watchers: ["someFile.js"],
filter: "someFilter",
subtasks: true,
},
solution: {
commits: ["5abcdef"],
Expand Down Expand Up @@ -1419,4 +1411,74 @@ The second uninterrupted step
expect(result.levels[0]).toEqual(expected.levels[0]);
});
});
describe("subtasks", () => {
it("should parse subtasks", () => {
const md = `# Subtask Demo
A demo demonstrating how to use subtasks
## 1. Subtask Example
A subtask example
### 1.1
Create a function \`add\` that can take a variety of params.
#### SUBTASKS
- Add one number
- Add two numbers
- Add three numbers`;
const skeleton = {
levels: [
{
id: "1",
steps: [
{
id: "1.1",
},
],
},
],
};
const expected = {
levels: [
{
id: "1",
title: "Subtask Example",
summary: "A subtask example",
content: "A subtask example",
steps: [
{
id: "1.1",
setup: {
subtasks: [
"Add one number",
"Add two numbers",
"Add three numbers",
],
commits: ["abcdef1"],
},
content:
"Create a function `add` that can take a variety of params.",
solution: {
commits: ["abcdef2"],
},
},
],
},
],
};
const result = parse({
text: md,
skeleton,
commits: {
"1.1:T": ["abcdef1"],
"1.1:S": ["abcdef2"],
},
});
expect(result.levels).toEqual(expected.levels);
});
});
});