Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feature/test output#11

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 3 commits intomasterfromfeature/test-output
May 31, 2020
Merged
Show file tree
Hide file tree
Changes from1 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
PrevPrevious commit
NextNext commit
large smoke test
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
@ShMcK
ShMcK committedMay 31, 2020
commit53cf62ca70fceda0d024e758d5253531ddc2d8e4
4 changes: 2 additions & 2 deletionssrc/utils/parse.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,10 +67,10 @@ export function parseMdContent(md: string): TutorialFrame | never {
// @ts-ignore
mdContent.levels[levelId] = {
id: levelId,
title: levelTitle,
title: levelTitle.trim(),
summary: levelSummary
? levelSummary.trim()
: _.truncate(levelContent, { length: 80, omission: "..." }),
: _.truncate(levelContent.trim(), { length: 80, omission: "..." }),
content: levelContent.trim(),
};
} else {
Expand Down
172 changes: 172 additions & 0 deletionstests/parse.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -437,6 +437,178 @@ The first step
expect(result.levels[0].steps[0]).toEqual(expected.levels[0].steps[0]);
});

it("should load the full config for a step", () => {
const md = `# Title

Description.

## L1 Title 1

First level content.

### L1S1

The first step

### L1S2

The second step

## L2 Title 2

Second level content.

### L2S1

The third step
`;
const config = {
levels: [
{
id: "L1",
steps: [
{
id: "L1S1",
setup: {
commands: ["npm install"],
files: ["someFile.js"],
watchers: ["someFile.js"],
filter: "someFilter",
subtasks: true,
},
solution: {
commands: ["npm install"],
files: ["someFile.js"],
},
},
{
id: "L1S2",
setup: {
commands: ["npm install"],
files: ["someFile.js"],
watchers: ["someFile.js"],
filter: "someFilter",
subtasks: true,
},
solution: {
commands: ["npm install"],
files: ["someFile.js"],
},
},
],
},
{
id: "L2",
summary: "Second level content.",
content: "First level content.",
steps: [
{
id: "L2S1",
setup: {
commands: ["npm install"],
files: ["someFile.js"],
watchers: ["someFile.js"],
filter: "someFilter",
subtasks: true,
},
solution: {
commands: ["npm install"],
files: ["someFile.js"],
},
},
],
},
],
};
const result = parse({
text: md,
config,
commits: {
L1S1Q: ["abcdefg1", "123456789"],
L1S1A: ["1gfedcba", "987654321"],
L1S2Q: ["2abcdefg"],
L1S2A: ["3abcdefg"],
L2S1Q: ["4abcdefg"],
L2S1A: ["5abcdefg"],
},
});
const expected = {
summary: {
description: "Description.",
},
levels: [
{
id: "L1",
title: "Title 1",
summary: "First level content.",
content: "First level content.",
steps: [
{
id: "L1S1",
content: "The first step",
setup: {
commits: ["abcdefg1", "123456789"],
commands: ["npm install"],
files: ["someFile.js"],
watchers: ["someFile.js"],
filter: "someFilter",
subtasks: true,
},
solution: {
commits: ["1gfedcba", "987654321"],
commands: ["npm install"],
files: ["someFile.js"],
},
},
{
id: "L1S2",
content: "The second step",
setup: {
commits: ["2abcdefg"],
commands: ["npm install"],
files: ["someFile.js"],
watchers: ["someFile.js"],
filter: "someFilter",
subtasks: true,
},
solution: {
commits: ["3abcdefg"],
commands: ["npm install"],
files: ["someFile.js"],
},
},
],
},
{
id: "L2",
title: "Title 2",
summary: "Second level content.",
content: "Second level content.",
steps: [
{
id: "L2S1",
content: "The third step",
setup: {
commits: ["4abcdefg"],
commands: ["npm install"],
files: ["someFile.js"],
watchers: ["someFile.js"],
filter: "someFilter",
subtasks: true,
},
solution: {
commits: ["5abcdefg"],
commands: ["npm install"],
files: ["someFile.js"],
},
},
],
},
],
};
expect(result.levels).toEqual(expected.levels);
});

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

[8]ページ先頭

©2009-2025 Movatter.jp