Skip to content
Merged
Show file tree
Hide file tree
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
setup tests
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Jun 21, 2020
commit 504103a41aa5e82525c2e0ad7ab4f1fb7e00b4cd
30 changes: 15 additions & 15 deletions tests/commitOrder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,45 @@ import { validateCommitOrder } from "../src/utils/validateCommits";

describe("commitOrder", () => {
it("should return true if order is valid", () => {
const positions = ["INIT", "L1", "L1S1", "L1S2", "L2", "L2S1"];
const positions = ["INIT", "1", "1.1", "1.2", "2", "2.1"];
const result = validateCommitOrder(positions);
expect(result).toBe(true);
});
it("should return true if valid with duplicates", () => {
const positions = [
"INIT",
"INIT",
"L1",
"L1",
"L1S1",
"L1S1",
"L1S2",
"L1S2",
"L2",
"L2",
"L2S1",
"L2S1",
"1",
"1",
"1.1",
"1.1",
"1.2",
"1.2",
"2",
"2",
"2.1",
"2.1",
];
const result = validateCommitOrder(positions);
expect(result).toBe(true);
});
it("should return false if INIT is out of order", () => {
const positions = ["INIT", "L1", "L1S1", "L1S2", "INIT", "L2", "L2S1"];
const positions = ["INIT", "1", "1.1", "1.2", "INIT", "2", "2.1"];
const result = validateCommitOrder(positions);
expect(result).toBe(false);
});
it("should return false if level after step is out of order", () => {
const positions = ["INIT", "L1", "L1S1", "L1S2", "L2S1", "L2"];
const positions = ["INIT", "1", "1.1", "1.2", "2.1", "2"];
const result = validateCommitOrder(positions);
expect(result).toBe(false);
});
it("should return false if level is out of order", () => {
const positions = ["INIT", "L1", "L3", "L2"];
const positions = ["INIT", "1", "L3", "2"];
const result = validateCommitOrder(positions);
expect(result).toBe(false);
});
it("should return false if step is out of order", () => {
const positions = ["INIT", "L1", "L1S1", "L1S3", "L1S2"];
const positions = ["INIT", "1", "1.1", "1.3", "1.2"];
const result = validateCommitOrder(positions);
expect(result).toBe(false);
});
Expand Down
16 changes: 8 additions & 8 deletions tests/markdown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe("validate markdown", () => {
const md = `
Description.

## L1 Put Level's title here
## Put Level's title here

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

Expand All @@ -19,7 +19,7 @@ Description.

# Another Title

## L1 Put Level's title here
## Put Level's title here

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

Expand All @@ -29,7 +29,7 @@ Some text that describes the level`;
Description.


## L1 Put Level's title here
## Put Level's title here

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

Expand All @@ -45,7 +45,7 @@ Some text that describes the level
it("should return false if missing a summary description", () => {
const md = `# A Title

## L1 Put Level's title here
## Put Level's title here

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

Expand Down Expand Up @@ -90,13 +90,13 @@ First step

Description.

## L1 Put Level's title here
## 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
### Step 1

First Step`;
expect(validateMarkdown(md)).toBe(true);
Expand All @@ -114,7 +114,7 @@ Should not be a problem
\`\`\`


## L1 Put Level's title here
## Put Level's title here

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

Expand All @@ -126,7 +126,7 @@ Some text that describes the level
Should not be an issue
\`\`\`

### L1S1
### Step 1

First Step`;
expect(validateMarkdown(md)).toBe(true);
Expand Down
Loading