Skip to content

Fixes #50

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
build without step commits
Signed-off-by: shmck <[email protected]>
  • Loading branch information
ShMcK committed Jun 25, 2020
commit efd3c0b3490407557ce3860f7de1ce579cdc2684
13 changes: 8 additions & 5 deletions src/utils/parse.ts
Original file line number Diff line number Diff line change
@@ -140,6 +140,7 @@ export function parse(params: ParseParams): any {
// add level step commits
const { steps, ...configLevelProps } = configLevel;
level = { ...configLevelProps, ...level };

if (steps) {
steps.forEach((step: T.Step, index: number) => {
try {
@@ -151,12 +152,14 @@ export function parse(params: ParseParams): any {
};

const stepSetupKey = `${step.id}:T`;

if (!step?.setup) {
step.setup = {};
}
if (!step.setup.commits) {
step.setup.commits = [];
}
if (params.commits[stepSetupKey]) {
if (!step.setup) {
step.setup = {
commits: [],
};
}
step.setup.commits = params.commits[stepSetupKey];
}

49 changes: 49 additions & 0 deletions tests/parse.test.ts
Original file line number Diff line number Diff line change
@@ -786,6 +786,55 @@ The first step
};
expect(result.levels).toEqual(expected.levels);
});
it("should load no commits if none found for a step", () => {
const md = `# Title

Description.

## 1. Title

First line

### 1.1

The first step
`;
const skeleton = {
levels: [
{
id: "1",
steps: [{ id: "1" }],
},
],
};
const result = parse({
text: md,
skeleton,
commits: {},
});
const expected = {
summary: {
description: "Description.",
},
levels: [
{
id: "1",
summary: "First line",
content: "First line",
steps: [
{
id: "1.1",
content: "The first step",
setup: {
commits: [],
},
},
],
},
],
};
expect(result.levels[0].steps[0]).toEqual(expected.levels[0].steps[0]);
});
});

describe("config", () => {