Skip to content

Feature/validate markdown #33

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 4 commits into from
Jun 13, 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
setup validate markdown tests
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Jun 13, 2020
commit d4916da5503533740b347a553b5cd31fdabd9e2c
106 changes: 99 additions & 7 deletions tests/markdown.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,103 @@
import * as T from "../typings/tutorial";
import { validateMarkdown } from "../src/utils/validateMarkdown";

describe("validate markdown", () => {
it.todo("should return false if missing a summary title (#)");
it.todo("should return false if contains multiple `#` headers");
it.todo("should return false if missing a summary description");
it.todo("should return false if `##` doesn't preface a level");
it.todo("should return false if `###` doesn't preface a step");
it.todo("should return true for valid markdown");
it("should return false if missing a summary title (#)", () => {
const md = `
Description.

## L1 Put Level's title here

> Level's summary: a short description of the level's content in one line.

Some text that describes the level`;
expect(validateMarkdown(md)).toBe(false);
});

it("should return false if contains multiple `#` headers", () => {
const md1 = `# A Title
Description.

# Another Title

## L1 Put Level's title here

> Level's summary: a short description of the level's content in one line.

Some text that describes the level`;

const md2 = `# A Title
Description.


## L1 Put Level's title here

> Level's summary: a short description of the level's content in one line.

Some text that describes the level

# Another title
`;
expect(validateMarkdown(md1)).toBe(false);
expect(validateMarkdown(md2)).toBe(false);
});

it("should return false if missing a summary description", () => {
const md = `# A Title

## L1 Put Level's title here

> Level's summary: a short description of the level's content in one line.

Some text that describes the level
`;
expect(validateMarkdown(md)).toBe(false);
});

it("should return false if `##` doesn't preface a level", () => {
const md = `# A Title

A description

## Put Level's title here

> Level's summary: a short description of the level's content in one line.

Some text that describes the level
`;
expect(validateMarkdown(md)).toBe(false);
});

it("should return false if `###` doesn't preface a step", () => {
const md = `# A Title

A description

## Put Level's title here

> Level's summary: a short description of the level's content in one line.

Some text that describes the level

### A Step

First step
`;
});

it("should return true for valid markdown", () => {
const md = `# Title

Description.

## L1 Put Level's title here

> Level's summary: a short description of the level's content in one line.

Some text that describes the level

### L1S1

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