Skip to content

Commit 504103a

Browse files
committed
setup tests
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent b34375b commit 504103a

File tree

5 files changed

+118
-118
lines changed

5 files changed

+118
-118
lines changed

tests/commitOrder.test.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,45 @@ import { validateCommitOrder } from "../src/utils/validateCommits";
22

33
describe("commitOrder", () => {
44
it("should return true if order is valid", () => {
5-
const positions = ["INIT", "L1", "L1S1", "L1S2", "L2", "L2S1"];
5+
const positions = ["INIT", "1", "1.1", "1.2", "2", "2.1"];
66
const result = validateCommitOrder(positions);
77
expect(result).toBe(true);
88
});
99
it("should return true if valid with duplicates", () => {
1010
const positions = [
1111
"INIT",
1212
"INIT",
13-
"L1",
14-
"L1",
15-
"L1S1",
16-
"L1S1",
17-
"L1S2",
18-
"L1S2",
19-
"L2",
20-
"L2",
21-
"L2S1",
22-
"L2S1",
13+
"1",
14+
"1",
15+
"1.1",
16+
"1.1",
17+
"1.2",
18+
"1.2",
19+
"2",
20+
"2",
21+
"2.1",
22+
"2.1",
2323
];
2424
const result = validateCommitOrder(positions);
2525
expect(result).toBe(true);
2626
});
2727
it("should return false if INIT is out of order", () => {
28-
const positions = ["INIT", "L1", "L1S1", "L1S2", "INIT", "L2", "L2S1"];
28+
const positions = ["INIT", "1", "1.1", "1.2", "INIT", "2", "2.1"];
2929
const result = validateCommitOrder(positions);
3030
expect(result).toBe(false);
3131
});
3232
it("should return false if level after step is out of order", () => {
33-
const positions = ["INIT", "L1", "L1S1", "L1S2", "L2S1", "L2"];
33+
const positions = ["INIT", "1", "1.1", "1.2", "2.1", "2"];
3434
const result = validateCommitOrder(positions);
3535
expect(result).toBe(false);
3636
});
3737
it("should return false if level is out of order", () => {
38-
const positions = ["INIT", "L1", "L3", "L2"];
38+
const positions = ["INIT", "1", "L3", "2"];
3939
const result = validateCommitOrder(positions);
4040
expect(result).toBe(false);
4141
});
4242
it("should return false if step is out of order", () => {
43-
const positions = ["INIT", "L1", "L1S1", "L1S3", "L1S2"];
43+
const positions = ["INIT", "1", "1.1", "1.3", "1.2"];
4444
const result = validateCommitOrder(positions);
4545
expect(result).toBe(false);
4646
});

tests/markdown.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ describe("validate markdown", () => {
55
const md = `
66
Description.
77
8-
## L1 Put Level's title here
8+
## Put Level's title here
99
1010
> Level's summary: a short description of the level's content in one line.
1111
@@ -19,7 +19,7 @@ Description.
1919
2020
# Another Title
2121
22-
## L1 Put Level's title here
22+
## Put Level's title here
2323
2424
> Level's summary: a short description of the level's content in one line.
2525
@@ -29,7 +29,7 @@ Some text that describes the level`;
2929
Description.
3030
3131
32-
## L1 Put Level's title here
32+
## Put Level's title here
3333
3434
> Level's summary: a short description of the level's content in one line.
3535
@@ -45,7 +45,7 @@ Some text that describes the level
4545
it("should return false if missing a summary description", () => {
4646
const md = `# A Title
4747
48-
## L1 Put Level's title here
48+
## Put Level's title here
4949
5050
> Level's summary: a short description of the level's content in one line.
5151
@@ -90,13 +90,13 @@ First step
9090
9191
Description.
9292
93-
## L1 Put Level's title here
93+
## Put Level's title here
9494
9595
> Level's summary: a short description of the level's content in one line.
9696
9797
Some text that describes the level
9898
99-
### L1S1
99+
### Step 1
100100
101101
First Step`;
102102
expect(validateMarkdown(md)).toBe(true);
@@ -114,7 +114,7 @@ Should not be a problem
114114
\`\`\`
115115
116116
117-
## L1 Put Level's title here
117+
## Put Level's title here
118118
119119
> Level's summary: a short description of the level's content in one line.
120120
@@ -126,7 +126,7 @@ Some text that describes the level
126126
Should not be an issue
127127
\`\`\`
128128
129-
### L1S1
129+
### Step 1
130130
131131
First Step`;
132132
expect(validateMarkdown(md)).toBe(true);

0 commit comments

Comments
 (0)