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/optional level description#54

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 2 commits intomasterfromfeature/optional-level-description
Jul 2, 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
NextNext commit
add optional level description tests
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
@ShMcK
ShMcK committedJul 1, 2020
commit4afd1178dabf06f340f4c5dec2f35289e38ac4b9
13 changes: 13 additions & 0 deletionstests/markdown.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -99,6 +99,19 @@ Some text that describes the level

### 1.1

First Step`;
expect(validateMarkdown(md)).toBe(true);
});

it("should allow for empty level content", () => {
const md = `# Title

Description.

## 1. Put Level's title here

### 1.1

First Step`;
expect(validateMarkdown(md)).toBe(true);
});
Expand Down
37 changes: 37 additions & 0 deletionstests/parse.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -232,6 +232,43 @@ But not including this line.
expect(result.levels[0]).toEqual(expected.levels[0]);
});

it("should allow for empty level content", () => {
const md = `# Title

Description.

## 1. Put Level's title here

### 1.1

A step
`;

const skeleton = { levels: [{ id: "1" }] };
const result = parse({
text: md,
skeleton,
commits: {},
});
const expected = {
levels: [
{
id: "1",
title: "Put Level's title here",
summary: "",
content: "",
steps: [
{
id: "1.1",
content: "A step",
},
],
},
],
};
expect(result.levels[0]).toEqual(expected.levels[0]);
});

it("should match line breaks with double line breaks for proper spacing", () => {
const md = `# Title

Expand Down
77 changes: 50 additions & 27 deletionstests/tutorial.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,48 @@ import * as T from "../typings/tutorial";
import tutorialSchema from "../src/schema/tutorial";
import { validateSchema } from "../src/utils/validateSchema";

const validJson: Partial<T.Tutorial> = {
version: "0.1.0",
summary: { title: "Title", description: "Description" },
config: {
testRunner: {
command: "aCommand",
args: {
filter: "filter",
tap: "tap",
},
directory: "coderoad",
setup: {
commits: ["abcdef1"],
commands: ["npm install"],
},
},
repo: {
uri: "https://github.com/some-repo.git",
branch: "someBranch",
},
dependencies: [{ name: "name", version: ">=1" }],
appVersions: {
vscode: ">=0.7.0",
},
},
levels: [
{
id: "1",
title: "Level 1",
summary: "The first level",
content: "The first level",
steps: [
{
id: "1.1",
content: "The first step",
setup: { commits: [] },
},
],
},
],
};

const validateTutorial = (json: any) => validateSchema(tutorialSchema, json);

describe("validate tutorial", () => {
Expand All@@ -12,37 +54,18 @@ describe("validate tutorial", () => {
expect(valid).toBe(false);
});
it("should return true for a valid tutorial", () => {
const json: Partial<T.Tutorial> = {
version: "0.1.0",
summary: { title: "Title", description: "Description" },
config: {
testRunner: {
command: "aCommand",
args: {
filter: "filter",
tap: "tap",
},
directory: "coderoad",
setup: {
commits: ["abcdef1"],
commands: ["npm install"],
},
},
repo: {
uri: "https://github.com/some-repo.git",
branch: "someBranch",
},
dependencies: [{ name: "name", version: ">=1" }],
appVersions: {
vscode: ">=0.7.0",
},
},
const valid = validateTutorial({ ...validJson });
expect(valid).toBe(true);
});
it("should return true for a tutorial with no level content", () => {
const json = {
...validJson,
levels: [
{
id: "1",
title: "Level 1",
summary: "The first level",
content: "The first level",
summary: "",
content: "",
steps: [],
},
],
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp