Skip to content

Commit 22eebf3

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

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
humanOpAppendLineAfterNthCommit("break", {
24+
filePath,
25+
commitSHA: commitOidsInLatestStacked[7].tostrS(),
26+
});
27+
},
28+
});
29+
30+
await gitStackedRebase(branch, {
31+
...common,
32+
apply: true,
33+
});
34+
}
35+
}

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)