Skip to content

Commit df197e3

Browse files
committed
create test case for parseNewGoodCommands
Signed-off-by: Kipras Melnikovas <kipras@kipras.org>
1 parent 6bf16a4 commit df197e3

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/* eslint-disable @typescript-eslint/camelcase */
2+
3+
import { gitStackedRebase } from "../git-stacked-rebase";
4+
import { humanOpAppendLineAfterNthCommit } from "../humanOp";
5+
6+
import { setupRepoWithStackedBranches } from "../test/setupRepo";
7+
8+
export async function parseNewGoodCommandsSpec() {
9+
await succeeds_to_apply_after_break_or_exec();
10+
11+
async function succeeds_to_apply_after_break_or_exec() {
12+
const { initialBranch, commitOidsInLatestStacked, dir, config } = await setupRepoWithStackedBranches();
13+
14+
const branch = initialBranch.shorthand();
15+
const common = {
16+
gitDir: dir,
17+
getGitConfig: () => config,
18+
} as const;
19+
20+
await gitStackedRebase(branch, {
21+
...common,
22+
editor: ({ filePath }) => {
23+
const commitSHA: string = commitOidsInLatestStacked[7].tostrS();
24+
humanOpAppendLineAfterNthCommit("break", {
25+
filePath,
26+
commitSHA,
27+
});
28+
},
29+
});
30+
31+
await gitStackedRebase(branch, {
32+
...common,
33+
apply: true,
34+
});
35+
}
36+
}

test/run.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { testCase } from "./experiment.spec";
44
import reducePathTC from "../reducePath.spec";
55

6+
import { parseNewGoodCommandsSpec } from "../parse-todo-of-stacked-rebase/parseNewGoodCommands.spec";
67
import { sequentialResolve } from "../util/sequentialResolve";
78

89
main();
@@ -11,6 +12,7 @@ function main() {
1112
sequentialResolve([
1213
testCase, //
1314
async () => reducePathTC(),
15+
parseNewGoodCommandsSpec,
1416
])
1517
.then(() => process.stdout.write("\nsuccess\n\n"))
1618
.catch((e) => {

0 commit comments

Comments
 (0)